[compute] 24/49: Using serial_reduce() when reducing on CPU device
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Fri Dec 18 17:58:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository compute.
commit d98e6dfee6d8d48093d093d7ebb8fbe0316faa04
Author: Jakub Szuppe <j.szuppe at gmail.com>
Date: Sat Aug 8 18:00:49 2015 +0200
Using serial_reduce() when reducing on CPU device
---
include/boost/compute/algorithm/reduce.hpp | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/include/boost/compute/algorithm/reduce.hpp b/include/boost/compute/algorithm/reduce.hpp
index 148b593..79624a0 100644
--- a/include/boost/compute/algorithm/reduce.hpp
+++ b/include/boost/compute/algorithm/reduce.hpp
@@ -198,16 +198,6 @@ inline void generic_reduce(InputIterator first,
}
}
-template<class InputIterator, class T>
-inline void dispatch_reduce(InputIterator first,
- InputIterator last,
- const buffer_iterator<T> result,
- const plus<T> &function,
- command_queue &queue)
-{
- reduce_on_gpu(first, last, result, function, queue);
-}
-
template<class InputIterator, class OutputIterator, class T>
inline void dispatch_reduce(InputIterator first,
InputIterator last,
@@ -216,10 +206,16 @@ inline void dispatch_reduce(InputIterator first,
command_queue &queue)
{
const context &context = queue.get_context();
+ const device &device = queue.get_device();
// reduce to temporary buffer on device
array<T, 1> tmp(context);
- dispatch_reduce(first, last, tmp.begin(), function, queue);
+ if(device.type() & device::cpu){
+ detail::serial_reduce(first, last, tmp.begin(), function, queue);
+ }
+ else {
+ reduce_on_gpu(first, last, tmp.begin(), function, queue);
+ }
// copy to result iterator
copy_n(tmp.begin(), 1, result, queue);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/compute.git
More information about the debian-science-commits
mailing list