Manolete
Manolete

Reputation: 3517

Pointers and arrays in an OpenMP depend list

I have got something like head.h:

struct mystruct {  
  double * a;                 
  double * t_a;          
}
typedef struct mystruct pm_t;

and my OpenMP task code mycode.c

int foo(pm_t* t_lb){

#pragma omp task default(none) shared(t_lb, BLOCK) private(i)   \
  firstprivate(baseIndex) depend (in: t_lb->a, t_lb->t_a)
    {
               ...  

Compiling with Intel 17 I get:

error: invalid entity for this variable list in omp clause
    firstprivate(baseIndex) depend (in: t_lb->a,t_lb->t_a)
                                          ^

I know that OpenMP does not deal with pointers in the depend syntax, but I have also tried with

firstprivate(baseIndex) depend (in: t_lb->a[:1], t_lb->t_a)

with no success. Does anybody see something wrong with this?

Upvotes: 1

Views: 462

Answers (1)

Manolete
Manolete

Reputation: 3517

Apparently, this should be an error according to the OpenMP specifications:

A variable that is part of another variable (such as an element of a structure) but is not an array element or an array section cannot appear in a depend clause." (Version 4.5, page 171, line 18).

However, this restriction is planned to be dropped for Version 5.0 and the Cray compiler has already done it internally. So this will fail with GCC and Intel but will work with the Cray compiler.

Upvotes: 1

Related Questions