"two data clauses for array" warning

Hello,

I’m seeing lots of messages like the following:

PGC-W-0155-two data clauses for array d (blah.c: 140)
PGC-W-0155-Accelerator region ignored; see -Minfo messages  (blah.c: 140)

140, present(d) followed by present(d); present attribute ignored
Accelerator region ignored
142, Accelerator restriction: size of the GPU copy of 'd' is unknown

A common situation in the application looks similar to the following pseudo code:

// At this point, 'd' is already allocated and initialized one level up in the call stack (via a data region)

#pragma acc kernels present(d[0:n])
for (..) {
}

if (some_test) {
  #pragma acc kernels present(d[0:n])
  for (..) {
  }
}

I’m using the present clauses to tell the compiler the sizes of the arrays and to keep the arrays local to the device. The arrays have already been allocated and initialized via a data region one level up the call chain.

If I’ve interpreted the compiler messages correctly, it looks like the compiler is getting confused by the consecutive present clauses, then ignores the second present data clause (and associated array sizes), and then ignores the second accelerator region because it ignored the array sizes.

Any ideas?

Hi poznanov,

I looks like a know compiler issue that will be fixed in our 12.4. The work around is to put a data region with the present clause around the two compute regions.

// At this point, 'd' is already allocated and initialized one level up in the call stack (via a data region)

#pragma data present(d[0:n])
{
#pragma acc kernels 
for (..) {
}

if (some_test) {
  #pragma acc kernels 
  for (..) {
  }
} 
}

Thanks,
Mat