Hi,
I want to parallelize a loop in a class member function. However there are two errors in the code:
class myclass
{
public:
int _k;
void f(int nb_examples, int nb_try)
{
int i;
int ks[nb_try];
// assignment to elements in ks
omp_set_num_threads(_nb_threads);
#pragma omp parallel shared(ks) private(i, _k) // error: ‘myclass::_k’ is not a variable in clause ‘private’
{
#pragma omp for schedule(dynamic) nowait
for(i=0; i < nb_try; i ++){
_k = ks[i];
if (_k > nb_examples) break;// error: break statement used with OpenMP for loop
// operations on _k
}
}
}
}
How to explain these errors and solve the problems? Thanks and regards!