Hello,
I am testing the declare directive. It seems to work in Fortran module
storage
implicit none
integer, parameter :: N = 128
real(kind(1.0)), allocatable:: A(:)
!$acc declare create(A)
end module storage
program declare
use storage
integer :: i
allocate(A(N))
!$acc parallel loop
do i=1,N
A(i) = i+1
enddo
!$acc end parallel loop
!$acc update host(A)
print*,'A(3) : ',A(3)
end program declare
but only for allocatable arrays. Otherwise I get the following error message:
PGF90-S-0155-module arrays in declare create, mirror, or device_resident must be allocatable
Using C, for global scope variable I cannot make declare working at all:
#define N 128
#include <openacc.h>
float A[N]; // *A
#pragma acc declare(A) // A[N]
int main() {
#pragma acc parallel loop
for(int i=0;i<N; i++)
{
A[i] = (float)(i-2)
}
#pragma acc update host(A)
printf("A[3]: %lf\n ", A[3]);
return 0;
}
thanks for support,
Francesco