[Omp] directive for

Christoph Niethammer christoph.niethammer at gmx.de
Wed Oct 5 09:07:52 PDT 2005


Hi Celso,

OpenMP schoul parallelise only the first loop. But you have to care about the 
loop indices of the inner loops! Per default they are, as all the variables, 
shared variables, so you have to declare them as private for all the threads. 
Otherwise you will get wron results!

> #pragma paralle for private(j,k)
>   for(i=0;i<N;i++){
>      for(j=0;j<M;j++){
>         for(k=0;j<P;k++){
>              a[i][j][k] = i+j+k;
> }}}

Christoph




More information about the Omp mailing list