#include #define SKEPU_CUDA #include "skepu/vector.h" #include "skepu/matrix.h" #include "skepu/map.h" using namespace std; // definition of functions to be used in the map and reduce UNARY_FUNC(inc, int, a, return(a+1); ) UNARY_FUNC(dec, int, a, return(a-1); ) UNARY_FUNC(sq, int, a, return(a*a); ) BINARY_FUNC(add, int, a, b, return(a+b); ) BINARY_FUNC(sub, int, a, b, return(a-b); ) BINARY_FUNC(mul, int, a, b, return(a*b); ) BINARY_FUNC(div, int, a, b, return(a/b); ) #define N 4 int main() { // declare vectors skepu::Vector v0(N); skepu::Vector v1(N); skepu::Vector v2(N); // initialize the vector(s) to some meaningful value for(int i=0; i sqmap(new sq); sqmap(v0,v2); cout << "After sqmap: " << v2 << endl; // two input map: forall i compute f(v0[i],v1[i]) // same as: alpha(f) o zip skepu::Map mapzip(new add); mapzip(v0,v1,v2); cout << "After mapzip: " << v2 << endl; return 0; }