depends clause with array

Discuss the OpenMP 4.0 Examples document.

depends clause with array

Postby pierrick » Thu Mar 13, 2014 12:40 am

Hi,

Looking at the example, I only see one example with dependency on array :

Code: Select all
// Assume BS divides N perfectly
void matmul_depend(int N, int BS, float A[N][N], float B[N][N], float C[N][N] ){
   int i, j, k, ii, jj, kk;
   for (i = 0; i < N; i+=BS) {
      for (j = 0; j < N; j+=BS) {
         for (k = 0; k < N; k+=BS) {
#pragma omp task depend ( in: A[i:BS][k:BS], B[k:BS][j:BS] ) \
            depend ( inout: C[i:BS][j:BS] )
            for (ii = i; ii < i+BS; ii++ )
               for (jj = j; jj < j+BS; jj++ )
                  for (kk = k; kk < k+BS; kk++ )
                     C[ii][jj] = C[ii][jj] + A[ii][kk] * B[kk][jj];
         }
      }
   }
}


This code is interesting but looks wrong as it use VLA. I mean it does the multiplication of matrix in C but C being a VLA parameter of the function, it is a deep copy of the C argument so nothing output will come from this function. Also it will lead to really bad performance as a deep copy for 3 "big" array will happen.

Also, VLA are optional with C11, is it required to support them for OpenMP 4.0?

Does someone have another code to test dependencies on array?
Thanks,
Pierrick
pierrick
 
Posts: 3
Joined: Wed Oct 23, 2013 4:17 am

Return to OpenMP 4.0 Examples

Who is online

Users browsing this forum: No registered users and 0 guests

cron