Hello,
I have three questions:
- present clause after copyin clause:
I have tried your OpenACC example from this article Account Login | PGI with a little modification. I used present clause in the callee function because in main function, we aready copied data into global memory.
In main function:
#pragma acc data copyin(x[0:n]) copy(y[0:n])
{
gettimeofday( &t0, NULL );
saxpy( n, a, x, y );
gettimeofday( &t1, NULL );
}
Original callee g code:
void saxpy( int n, float a, float x[], float y[] ){
#pragma acc parallel loop pcopyin(x[0:n],a,n) pcopy(y[0:n])
for( int i = 0; i < n; ++i )
y[i] += a*x[i];
#pragma acc wait
}
Edited code with present clause instead of pcopyin and pcopy:
void saxpy( int n, float a, float x[], float y[] ){
#pragma acc parallel loop present(x[0:n],a,n) present(y[0:n])
for( int i = 0; i < n; ++i )
y[i] += a*x[i];
#pragma acc wait
}
The program was compiled successfully. But when I executed the program:
./saxpy_test_data
FATAL ERROR: data in PRESENT clause was not found on device 1: name=y
file: <PATH>/openacc_pgc++/saxpy.cpp _Z5saxpyifPfS_ line:1
I think we already copied y into device memory in main function in main function? But, y was not available in device memory at runtime?
-
How to deallocate memory which is allocated by copy/create clause?
-
What is pgi_uacc_cuda_fill ? I have this information when I profiled my application.
Thank you very much,
Regards,
Minh