We have a problem where the compiler is supressing acceleration becuase it believes some of our arrays are functions. At first I assumed this was due to it being a part of a large and complex code (MFIX), but we have boiled it down to the demonstration code below (which I would be happy to send through other channels). This code generates:
PGF90-W-0155-Accelerator region ignored; see -Minfo messages (test.f90: 51)
main:
51, Accelerator region ignored
56, Accelerator restriction: function/procedure calls are not supported
60, Accelerator restriction: function/procedure calls are not supported
If we simply comment out line 60 (array PFN), then it will generate a kernel. Grateful for any insight.
John
!!! Update the list of particles contacting a given particle, by removing particles no longer in contact
!!! Compile with
!!! pgf90 -Munixlogical -o test test.f90
!!! or
!!! pgf90 -acc -ta=nvidia,time -Minfo=accel -Munixlogical -o test-gpu test.f90
PROGRAM MAIN
IMPLICIT NONE
INTEGER, DIMENSION(3,11) :: PN, PV
DOUBLE PRECISION, DIMENSION(3,11,2) :: PFN
INTEGER LL, NI, NLIM, MAXNEIGHBORS, MAX_PIP
!!! Extra variables needed for new algorithm
INTEGER CHK1, CHK2, SHIFT
!!! Input data for the test
MAX_PIP=3
MAXNEIGHBORS = 10
PN(1,:)=(/7, 5,11,33,20,17,35,4,-1,-1,-1/)
PV(1,:)=(/7, 1, 0, 1, 1, 0, 0,1, 0, 0, 0/)
PFN(1,:,1)=PN(1,:)
PFN(1,:,2)=PV(1,:)
PN(2,:)=(/10, 5,11,33,20,17,35,4,111,12,13/)
PV(2,:)=(/10, 0, 0, 0, 0, 0, 0,0, 1, 0, 0/)
PFN(2,:,1)=PN(1,:)
PFN(2,:,2)=PV(1,:)
PN(3,:)=(/2, 39,101,-1,-1,-1,-1,-1,-1,-1,-1/)
PV(3,:)=(/2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/)
PFN(3,:,1)=PN(1,:)
PFN(3,:,2)=PV(1,:)
!!! End of input data
!!! Print the input data
PRINT , ‘Before update:’
PRINT , ‘==============’
DO LL=1, MAX_PIP
WRITE (,‘(1X,I3,1X,A,I3)’) &
PN(LL,1), ’ particles in contact with particle ', LL
WRITE (,‘(A,$)’) ‘They are: ’
DO NI=2,PN(LL,1)+1
WRITE (*,’(I4,1X,$)‘), PN(LL,NI)
ENDDO
PRINT *,’\n\n’
ENDDO
!$acc kernels
DO LL=1,MAX_PIP !Loop over particles
!!! New update algorithm without if statement
SHIFT=0
DO NI=2,PN(LL,1)+1
CHK1 = (PV(LL,NI).EQ.0)
CHK2 = (PV(LL,NI).NE.0)
PN(LL,NI-SHIFTCHK2)=PN(LL,NI)
PFN(LL,NI-SHIFTCHK2,:)=PFN(LL,NI,:)
SHIFT=SHIFT+CHK1
ENDDO
PN(LL,1)=PN(LL,1)-SHIFT
ENDDO !Loop over particles
!$acc end kernels
!!! Print the results
PRINT , ‘After update:’
PRINT , ‘=============’
DO LL=1,MAX_PIP
WRITE (,‘(1X,I3,1X,A,I3)’) &
PN(LL,1), " particles in contact with particle ", LL
WRITE (,‘(A,$)’) "They are: "
DO NI=2,PN(LL,1)+1
WRITE (*,‘(I4,1X,$)’), PN(LL,NI)
ENDDO
PRINT *,‘\n’
! PRINT *, “The full arrays PN and PV are :”
! DO NI=2,MAX_NEIGHBOURS+1
! PRINT *, PN(LL,NI), " ",PV(LL,NI)
! ENDDO
ENDDO
END