0

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?

4

1 回答 1

1

这是一个范围界定问题,编译器没有保留“br”是并行区域的本地。由于我为 PGI 工作,我添加了一份问题报告 (TPR#22760) 并将其发送给我们的编译器工程师以进行进一步评估。

于 2016-07-20T18:02:41.413 回答