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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -