Hi when I compile the code below I get warnings stating that data1 and data2 are not pointers to shared data, how can I remove these warnings (the code seems to run correctly).
Here is the source code
#include <cilk/cilk.h> #include <offload.h> #include <omp.h> #include <stdio.h> _Cilk_shared double * _Cilk_shared data1; _Cilk_shared double * _Cilk_shared data2; _Cilk_shared int length = 100000; class _Cilk_shared adder{ public: void addArrays(double * a, double * b, int length); }; void adder::addArrays(double * a, double * b, int length){ if(_Offload_get_device_number() >= 0) printf("On micn"); else printf("On hostn"); #pragma omp parallel for default(none) shared(a,b,length) for(int i=0; i<length; i++){ a[i] += b[i]; }; }; _Cilk_shared adder addObj; int main(){ data1 = (_Cilk_shared double * _Cilk_shared) _Offload_shared_malloc(sizeof(double)*length); data2 = (_Cilk_shared double * _Cilk_shared) _Offload_shared_malloc(sizeof(double)*length); for(int i=0; i<length; i++){ data1[i] = i; data2[i] = i; } _Cilk_offload addObj.addArrays(data1,data2,length); for(int i=0; i<length; i++){ if(data1[i]!=2*i){ printf("Something has gone wrongn"); return 1; } } printf("Everything went okayn"); return 0; }
Here are the warnings I get when I compile
main.cpp(35): warning #2707: pointer argument in _Cilk_offload function call is not pointer-to-shared _Cilk_offload addObj.addArrays(data1,data2,length); ^ main.cpp(35): warning #2707: pointer argument in _Cilk_offload function call is not pointer-to-shared _Cilk_offload addObj.addArrays(data1,data2,length);