==== SKEPU mapreduce code sample ==== We show an implementation of vector dotproduct with both mapreduce and with a map followed by a reduce, to appreciate optimizations in the mapreduce skeleton. // following define to enable/disable OpenMP implmentation to be used // #define SKEPU_OPENMP #define SKEPU_CUDA // following define to enable/disable OpenCL implmentation to be used //#define SKEPU_OPENCL // With OpenCL, following define to specify number of GPUs to be used. Specifying 0 means all available GPUs. Default is 1 GPU. /* #define SKEPU_NUMGPU 0 */ #include #include #include "skepu/vector.h" #include "skepu/mapreduce.h" #include "skepu/map.h" #include "skepu/reduce.h" // User-function used for mapping BINARY_FUNC(mult_f, float, a, b, return a*b; ) // User-function used for reduction BINARY_FUNC(plus_f, float, a, b, return a+b; ) #define N (1024*1024) //#define N 16 int main() { skepu::MapReduce dotProduct(new mult_f, new plus_f); skepu::Map mapzip(new mult_f); skepu::Reduce redsum(new plus_f); skepu::Vector v0(N, (float)2); skepu::Vector v1(N, (float)5); skepu::Vector vtemp(N, (float)0); // std::cout<<"v0: " <