PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Fatal Error in ACC kernels
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
mkcolg



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

PostPosted: Mon Aug 05, 2013 8:29 am    Post subject: Reply with quote

Quote:
I'm guessing that perhaps the allocation on the device for ytop2horiz is disregarded if its length is zero?
The compiler will handle the case where the array is length zero so I'm not clear why you'd get the "present" error. Perhaps something with the inline routine.

- Mat
Back to top
View user's profile
nchlsearl



Joined: 13 Jun 2013
Posts: 6

PostPosted: Wed Aug 07, 2013 7:55 pm    Post subject: Reply with quote

I think I may have found my issue. It seems that there is an issue with the accelerator trying to automatically allocate arrays using the limits of the do loop. For instance, consider the mock code below:
Code:

      SUBROUTINE TEST(alpha, amax, beta)

      INTEGER i, j, alpha, amax, beta
      DOUBLE PRECISION tarray, betalim
      DIMENSION tarray(beta, alpha), betalim(amax)

c
c$ acc kernels loop
c
      DO i = 1, alpha,
          DO j = 1, betalim(amax)
              IF (i.GT.betalim(j)) EXIT

              tarray(j,i) = 10

          ENDDO
      ENDDO

      END


When I compile the actual code, I get output like:
Code:
Generating present_or_copy(tarray(:ibetlim,:alpha))


The compiling finishes successfully, but running the program yields:
Code:
FATAL ERROR: data in PRESENT clause was not found on device 1: name=tarray


When I change the upper limit of the inner loop to a defined int value -- alpha for instance -- it no longer causes the error, and the program runs fine.
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Aug 08, 2013 7:51 am    Post subject: Reply with quote

Hi nchlsearl,

Can you please post a reproducing example? I tried using your mock code but don't see the same feedback message. Also what is the "ibetlim" varible?

Thanks,
Mat

Code:
% cat test.f
      SUBROUTINE TEST(alpha, amax, beta)

      INTEGER i, j, alpha, amax, beta
      DOUBLE PRECISION tarray, betalim
      DIMENSION tarray(beta, alpha), betalim(amax)

!$acc kernels loop
      DO i = 1, alpha
          DO j = 1, betalim(amax)
              IF (i.GT.betalim(j)) EXIT
              tarray(j,i) =  real(i+j)
          ENDDO
      ENDDO

      print *, tarray
      END

% pgf90 -c -acc -Minfo=accel test.f -V13.7
test:
      7, Generating present_or_copyin(betalim(:))
         Generating present_or_copy(tarray(:,:alpha))
         Generating NVIDIA code
         Generating compute capability 1.3 binary
         Generating compute capability 2.0 binary
         Generating compute capability 3.0 binary
      8, Loop is parallelizable
         Accelerator kernel generated
          8, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
      9, Inner sequential loop scheduled on accelerator
Back to top
View user's profile
nchlsearl



Joined: 13 Jun 2013
Posts: 6

PostPosted: Thu Aug 08, 2013 1:21 pm    Post subject: Reply with quote

Here is working test code. The ibetlim should have just been betlim, sorry about that.

Code:
      PROGRAM TEST_CASE

      IMPLICIT NONE

      INTEGER i, j, Alpha, Beta
      INTEGER Firstarray, Secondarray
      INTEGER Betlim

      DIMENSION Firstarray(Beta,Alpha),
     &          Secondarray(Beta,Alpha), Betlim(Alpha)

      Alpha = 100
      Beta = 100
c
c$acc kernels loop
c
      DO i = 1, Alpha
        DO j = 1, Betlim(Alpha)
            IF ( j.GT.Betlim(i) ) EXIT
            Firstarray(j,i) = 10
            Secondarray(j,i) = 20
        ENDDO
      ENDDO

      PRINT *, Firstarray(10,10), Secondarray(10,10)

      END PROGRAM TEST_CASE


This compiles fine using
Code:
pgfortran -fast -acc -Minfo=acc test_case.for -o test_case
with output

Code:
test_case:
     15, Generating present_or_copy(firstarray(:betlim,:100))
         Generating present_or_copy(secondarray(:betlim,:100))
         Generating present_or_copyin(betlim(:100))
         Generating NVIDIA code
         Generating compute capability 1.0 binary
         Generating compute capability 2.0 binary
         Generating compute capability 3.0 binary
     17, Loop is parallelizable
         Accelerator kernel generated
         17, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
     18, Inner sequential loop scheduled on accelerator


Running the program yields
Code:
FATAL ERROR: data in PRESENT clause was not found on device 1: name=firstarray
 file:/home/nearl/ELC/test_case.for test_case line:15


Thanks again for all your help.
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Aug 08, 2013 4:40 pm    Post subject: Reply with quote

Hi nchlsearl,

Looks like the release compiler is not catching a problem with your code. With our development compiler I get the following:
Code:
% pgf90 -acc -Minfo test.f90 -Mfixed -Vdev
PGF90-S-0310-Adjustable array can not have automatic bounds specifiers - firstarray (test.f90)
PGF90-S-0310-Adjustable array can not have automatic bounds specifiers - secondarray (test.f90)
PGF90-S-0310-Adjustable array can not have automatic bounds specifiers - betlim (test.f90)
  0 inform,   0 warnings,   3 severes, 0 fatal for test_case


To fix, have Alpha and Beta be parameters so that the arrays get sized correctly.

Code:
% cat test2.f90
      PROGRAM TEST_CASE

      IMPLICIT NONE

      INTEGER i, j, Alpha, Beta
      PARAMETER Alpha=100, Beta=100
      INTEGER Firstarray, Secondarray
      INTEGER Betlim

      DIMENSION Firstarray(Beta,Alpha),
     &          Secondarray(Beta,Alpha), Betlim(Alpha)

c      Alpha = 100
c      Beta = 100
c
c$acc kernels loop
c
      DO i = 1, Alpha
        DO j = 1, Betlim(Alpha)
            IF ( j.GT.Betlim(i) ) EXIT
            Firstarray(j,i) = 10
            Secondarray(j,i) = 20
        ENDDO
      ENDDO

      PRINT *, Firstarray(10,10), Secondarray(10,10)

      END PROGRAM TEST_CASE

% pgf90 -acc -Minfo test2.f90 -V13.7 -Mfixed
test_case:
     16, Generating present_or_copy(firstarray(:betlim,:))
         Generating present_or_copy(secondarray(:betlim,:))
         Generating present_or_copyin(betlim(:))
         Generating NVIDIA code
         Generating compute capability 1.0 binary
         Generating compute capability 2.0 binary
         Generating compute capability 3.0 binary
     18, Loop is parallelizable
         Accelerator kernel generated
         18, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
     19, Inner sequential loop scheduled on accelerator
% a.out
            0            0


Hope this helps,
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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