[arrayfire] 32/284: convert sort & sort_by_key cpu fns to async calls
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit 840af46e2ccce3ee3b0e23b65ac18f28231b9a1e
Author: pradeep <pradeep at arrayfire.com>
Date: Mon Nov 23 13:35:11 2015 -0500
convert sort & sort_by_key cpu fns to async calls
---
src/backend/cpu/sort.cpp | 7 ++++---
src/backend/cpu/sort_by_key.cpp | 9 ++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/backend/cpu/sort.cpp b/src/backend/cpu/sort.cpp
index 0b3fb9a..94d70a8 100644
--- a/src/backend/cpu/sort.cpp
+++ b/src/backend/cpu/sort.cpp
@@ -15,6 +15,8 @@
#include <err_cpu.hpp>
#include <algorithm>
#include <functional>
+#include <platform.hpp>
+#include <async_queue.hpp>
using std::greater;
using std::less;
@@ -29,7 +31,7 @@ namespace cpu
// Based off of http://stackoverflow.com/a/12399290
template<typename T, bool isAscending>
- void sort0(Array<T> &val)
+ void sort0(Array<T> val)
{
// initialize original index locations
T *val_ptr = val.get();
@@ -62,8 +64,7 @@ namespace cpu
{
Array<T> out = copyArray<T>(in);
switch(dim) {
- case 0: sort0<T, isAscending>(out);
- break;
+ case 0: getQueue().enqueue(sort0<T, isAscending>, out); break;
default: AF_ERROR("Not Supported", AF_ERR_NOT_SUPPORTED);
}
return out;
diff --git a/src/backend/cpu/sort_by_key.cpp b/src/backend/cpu/sort_by_key.cpp
index 4b0a092..684b9ba 100644
--- a/src/backend/cpu/sort_by_key.cpp
+++ b/src/backend/cpu/sort_by_key.cpp
@@ -15,14 +15,14 @@
#include <algorithm>
#include <numeric>
#include <queue>
-#include <future>
+#include <platform.hpp>
+#include <async_queue.hpp>
using std::greater;
using std::less;
using std::sort;
using std::function;
using std::queue;
-using std::future;
using std::async;
namespace cpu
@@ -32,7 +32,7 @@ namespace cpu
///////////////////////////////////////////////////////////////////////////
template<typename Tk, typename Tv, bool isAscending>
- void sort0_by_key(Array<Tk> &okey, Array<Tv> &oval, const Array<Tk> &ikey, const Array<Tv> &ival)
+ void sort0_by_key(Array<Tk> okey, Array<Tv> oval, const Array<Tk> ikey, const Array<Tv> ival)
{
function<bool(Tk, Tk)> op = greater<Tk>();
if(isAscending) { op = less<Tk>(); }
@@ -101,8 +101,7 @@ namespace cpu
okey = createEmptyArray<Tk>(ikey.dims());
oval = createEmptyArray<Tv>(ival.dims());
switch(dim) {
- case 0: sort0_by_key<Tk, Tv, isAscending>(okey, oval, ikey, ival);
- break;
+ case 0: getQueue().enqueue(sort0_by_key<Tk, Tv, isAscending>, okey, oval, ikey, ival); break;
default: AF_ERROR("Not Supported", AF_ERR_NOT_SUPPORTED);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list