I wanted to use acc_map_data and wrote a sample code.
But an error occurred in execution.
Could you teach me how to use acc_map_data?
#include<stdio.h>
#include<stdlib.h>
#define N 10
int main(void)
{
float *a = (float*) malloc(N*sizeof(float));
float *d_a = (float*)acc_malloc(N*sizeof(float));
printf("%x, %x\n", a, d_a);
acc_map_data(a, d_a, N*sizeof(float));
#pragma acc update device (a[0:N])
#pragma acc update host(a[0:N])
acc_unmap_data(a);
acc_free(d_a);
}
$ pgcc --version
pgcc 15.5-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
$ pgcc -acc acc_map_data.c
PGC-W-0155-Pointer value created from a nonlong integral type (acc_map_data.c: 9)
PGC/x86-64 Linux 15.5-0: compilation completed with warnings
$ ./a.out
d7a150, 47c0000
call to cuMemcpyHtoDAsync returned error 1: Invalid value