PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

[pgi apm] prevent data transfer on sub calls

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



Joined: 23 Oct 2012
Posts: 2

PostPosted: Tue Oct 23, 2012 2:21 am    Post subject: [pgi apm] prevent data transfer on sub calls Reply with quote

Hi

There is code below. Please say me how I can prevent data transfer on sub calls? When I use reflected(a) directive, I get segfault

Note: question is about PGI APM, not OpenACC. Compiler is pgfortran 11.5

Code:

   program test
   parameter (n = 100)
   double precision a(n,n,n)

!$acc data region copy(a)
   call foo(a,n)
   call goo(a,n)
!$acc end data region

   end
   

   subroutine foo(a,n)

   double precision a(n,n,n)
!$acc region
   do k = 1,n
   do j = 1,n
   do i = 1,n
         a(i,j,k) = ( 1. + i + j + k)
   end do
   end do
   end do
!$acc end region

   end

   subroutine goo(a,n)

   double precision a(n,n,n)
      
!$acc region
   do k = 2,n-1
   do j = 2,n-1
   do i = 2,n-1
         a(i,j,k) = ( a(i-1,j,k) + a(i+1,j,k) ) / 2
   end do
   end do
   end do
!$acc end region

   end




Code:

$ pgfortran -V

pgfortran 11.5-0 64-bit target on x86-64 Linux -tp nehalem
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Oct 23, 2012 8:44 am    Post subject: Reply with quote

Hi krvladislav,

Reflected is the correct method, however, your routines need to have interfaces to use it. The easiest thing to is put "foo" and "goo" into a module where an implicit interface will be created.

Hope this helps,
Mat
Back to top
View user's profile
krvladislav



Joined: 23 Oct 2012
Posts: 2

PostPosted: Wed Oct 24, 2012 2:06 am    Post subject: Reply with quote

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