I have an array of size N on my host. I will transfer it to my device and then I try to assign an alias to it and use that. But, I get a "Cannot determine bounds for array" compilation error.
Example:
#include <openacc.h>
#include <stdio.h>
#include <stdlib.h>
#define N 1000
int main() {
double *ar = (double*) malloc(sizeof(double) * N);
int i;
for(i=0;i<N;i++)
ar[i] = (i+1) * 1.0;
#pragma acc data copy(ar[0:N])
#pragma acc parallel
{
ar[90] = 29;
double *br = ar;
br[6] = 91;
}
ar[129] = 0.154;
for(i=0;i<N;i++)
if(ar[i] != (i+1) * 1.0)
printf("ERROR: %d - %.3f\n", i, ar[i]);
free(ar);
return 0;
}
Above code will result in following error:
PGC-S-0155-Cannot determine bounds for array br (array.c: 15)
Even, if I try to be more specific and try this double *br = &ar[0];
, the same thing happens.
I am using PGI 16.5 64-bit version with CUDA 7.5 on a cc20 device.
Since I am using a valid array, the aliasing should not be a problem, right? Is this a bug?
It's a scoping issue where the compiler isn't retaining that "br" is local to the parallel region. Since I work for PGI, I added a problem report (TPR#22760) and sent it to our compiler engineers for further evaluation.