Omp for with collapse clause does not compile

I am parallelizing the parallel for construct in OpenMP.

In the OpenMP specifications, I see:

 void sub(float *a) { int i, j, k; #pragma omp for collapse(2) private(i, k, j) for (k=kl; k<=ku; k+=ks) for (j=jl; j<=ju; j+=js) for (i=il; i<=iu; i+=is) bar(a,i,j,k); } 

I wrote code that is very similar to me, but it does not compile:

unexpected token after reduction offer

 #pragma omp for collapse(2) for(int i=0;i<Nm;i++) for(int k=0;k<m_ndim;k++) points_[i][k]=TRandom::randD(lower[k],upper[k]); 

Why doesn't it work?

+6
source share
1 answer

collapse is the pragma of OpenMP 3.0. The error message you received is usually associated with a compiler that only implements OpenMP 2.x.

+5
source

Source: https://habr.com/ru/post/913318/


All Articles