MCPcopy Create free account
hub / github.com/boostorg/compute / dispatch_reduce

Function dispatch_reduce

include/boost/compute/algorithm/reduce.hpp:206–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204
205template<class InputIterator, class OutputIterator, class T>
206inline void dispatch_reduce(InputIterator first,
207 InputIterator last,
208 OutputIterator result,
209 const plus<T> &function,
210 command_queue &queue)
211{
212 const context &context = queue.get_context();
213 const device &device = queue.get_device();
214
215 // reduce to temporary buffer on device
216 array<T, 1> value(context);
217 if(device.type() & device::cpu){
218 detail::reduce_on_cpu(first, last, value.begin(), function, queue);
219 }
220 else {
221 reduce_on_gpu(first, last, value.begin(), function, queue);
222 }
223
224 // copy to result iterator
225 copy_n(value.begin(), 1, result, queue);
226}
227
228template<class InputIterator, class OutputIterator, class BinaryFunction>
229inline void dispatch_reduce(InputIterator first,

Callers 1

reduceFunction · 0.85

Calls 8

reduce_on_cpuFunction · 0.85
reduce_on_gpuFunction · 0.85
copy_nFunction · 0.85
generic_reduceFunction · 0.85
get_contextMethod · 0.45
get_deviceMethod · 0.45
typeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected