In a member function, I can parallelize using a shared member variable int *x, like this
#pragma omp parallel for default(shared)
for(int i=0;i<size;i++) {
x[i]=i;
}
But if I try
#pragma omp parallel for default(none) shared(x,size)
for(int i=0;i<size;i++) {
x[i]=i;
}
I get an error: 'obj::x' is not a variable in clause 'shared'. I would prefer the second version because it declares the common variables with which it works, reminding me that there are no race conditions or similar problems.
What happens with OpenMP claiming to be obj::xnot a variable?
source
share