Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
29 Views

openmp task depend in c++ 15 compiler

Hi,

I'm experimenting with openmp task parallelism and the depend clause. The following code 

#include <iostream>

//void solve(int N, double* a, double* b) {            // this works                       
template<typename S> void solve(int N, S* a, S* b) {   // this does not                         
  int T = 4;
#pragma omp taskgroup
  {
    for (int i=0; i<N; i+=T) {
#pragma omp task depend(inout:b)
      {
        for (int k=0; k<T; k++)
          for (int l=0; l<k; l++)
            b[i+k] -= a[i+k+(i+l)*N]*b[i+l];
      }
      for (int j=i+T; j<N; j+=T)
#pragma omp task depend(in:b) depend(inout:b)
        {
          for (int k=0; k<T; k++)
            for (int l=0; l<T; l++)
              b[j+k] -= a[j+k+(i+k)*N]*b[i+l];
        }
    }
  }
}

int main(int argc, char* argv[]) {
  int N = 64;
  double* a = new double[N*N];
  double* b = new double;
  for (int k=0; k<N; k++)
    for (int l=0; l<N; l++)
      a[k+l*N] = 1./((k-l)*(k-l)+1);
  for (int i=0; i<N; i++) b = i;

  solve(N, a, b);

  for (int i=0; i<N; i++) std::cout << b << std::endl;
}

 

fails with 

testDepend.cpp(9): error: invalid entity for this variable list in omp clause
  #pragma omp task depend(inout:b)

Is this not allowed? It works when I remove the template parameter, ie, just make it double and both versions work with g++ 4.9.1.

I'm using icpc (ICC) 15.0.0 20140530. It's a beta version. Sorry if this is already fixed in a later version of the compiler.

 

0 Kudos
1 Reply
Highlighted
Black Belt
29 Views

It appears to work OK with 64-bit 15.0.0.108 20140726.

0 Kudos