c++ - How to write "target data map" for std::vector in OpenMP 4? -
i want use c++ , vectors
. had c code c arrays created this:
double* data = (double*)malloc(sizeof(double) * n); double* result = (double*)malloc(sizeof(double) * n); #pragma omp target data map(tofrom: data[0:n],result[0:n]) //loop
now use c++ vector , get:
example.cpp:31:41: error: expected variable name or array item #pragma omp target data map(tofrom: data[0:n],result[0:n])
here openmp4 introduced user-defined reductions. have analogs data maps?
you pointers of underlying storage of std::vector
, use them in same way in c code.
double* data = vec_data.data(); double* result = vec_res.data(); int n = vec_data.size(); #pragma omp target data map(tofrom:data[0:n],result[0:n]) //loop
Comments
Post a Comment