FATAL ERROR with acc_map_data

Here I used acc_map_data, I set /usr/apps/isv/pgi/pgiset14.1.sh
There comes fatal error.
The below code can only work on OpenACC 2.0?

FATAL ERROR: variable data clause is partially present on the GPU: name=G

int N=128,X=10;
float *G,*G1;
G =(float *)calloc (N,sizeof(float));
G1 =(float *)acc_malloc((N-X)*sizeof(float));
acc_map_data(&G, G1, (N-X)*sizeof(float));
#pragma acc data update device(G[X:N])
acc_unmap_data(&G);

Hi Guanghao_Jin,

The error is correct. “G[X:N]” is stating to start a element X (10) and copy over N (128) elements. G1 is only N-X (118) elements so is only “partially present” on the GPU.

To fix, either copy over only N-X elements or increase the size of G1.

Hope this helps,
Mat