PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

induction variable live-out from loop when var used before

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



Joined: 14 Mar 2011
Posts: 8
Location: Daresbury Lab, UK

PostPosted: Mon Mar 14, 2011 4:46 am    Post subject: induction variable live-out from loop when var used before Reply with quote

Hello,

I'm pretty new to using the PGI accelerator compiler but have found a slight issue with the following (simplified)code:

Code:
 
ALLOCATE(some_arrays, Stat=jn)
  IF(jn /= 0)THEN
     WRITE (*,*) 'Alloc failed in simple_kernel - returning'
     RETURN
  END IF

!$ACC REGION copy(pta) copyin(ptb,umask,vmask) local(zgb,zga)
     DO jn = 1, kjpt

        DO jk=1, jpkm1, 1
           DO jj=1, jpjm1, 1
Set some array values here... 
          END DO
        END DO
     END DO
!$ACC END REGION

If I compile the code as shown I get:
Accelerator restriction: induction variable live-out from loop: jn
for each line inside my nested loop (of form blah(1,jj,jk,jn) = 1.0).
However, if I change the ALLOCATE statement to use ierr, say, instead of jn to check the status then these messages go away which is what I'd expect as the value of jn isn't used after the accelerated region.

I'm using version 11.0 of pgf90 with cuda 3.1 on a 64-bit linux box.

Cheers,

Andy.[/code]
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Mar 14, 2011 9:19 am    Post subject: Reply with quote

Hi Andy,

ALLOCATE isn't a pure function, hence the compiler must assume that some other memory location could be using jn.

To work around this issue, either use a different variable for STAT or privatize jn:

Code:

!$ACC REGION copy(pta) copyin(ptb,umask,vmask) local(zgb,zga)
  !$ACC DO private(jn)
     DO jn = 1, kjpt
...


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



Joined: 14 Mar 2011
Posts: 8
Location: Daresbury Lab, UK

PostPosted: Mon Mar 14, 2011 10:01 am    Post subject: Thanks Reply with quote

Ah, I see - 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