Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

omp for with collapse clause is not compiling

I am parallelizing with a parallel for construct in OpenMP.

In OpenMP specs, I can 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've written code that I find quite similar, but it does not compile:

unexpected token after collapse clause

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

Why isn't it working?

like image 817
kiriloff Avatar asked Apr 16 '12 12:04

kiriloff


1 Answers

collapse is an OpenMP 3.0 pragma. The error message you received is usually due to a compiler that implements OpenMP 2.x only.

like image 77
Thomas W. Avatar answered Oct 09 '22 17:10

Thomas W.