PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

openacc declare

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Franziskonew



Joined: 05 Feb 2014
Posts: 4

PostPosted: Thu Feb 13, 2014 3:00 am    Post subject: openacc declare Reply with quote

Hello,
I am testing the declare directive. It seems to work in Fortran module

Code:
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:
Quote:
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:

Code:
#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
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6208
Location: The Portland Group Inc.

PostPosted: Thu Feb 13, 2014 9:18 am    Post subject: Reply with quote

Hi Francesco,

Quote:
but only for allocatable arrays. Otherwise I get the following error message:
Correct.

Quote:
Using C, for global scope variable I cannot make declare working at all:
Support for global static variables in a declare create clause is currently scheduled for the 14.3 release.

Thanks,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group