Hi, I’m getting some strange behavior with the following code. If I declare the sizes of the array dummy variables I get a segmentation fault in the first do loop where the values in ia don’t seem to be copied correctly. The previous dummies were defined as follows:
integer ia(neq+1)
integer ja(mxstif)
double precision a(mxstif)
double precision b(neq)
double precision x(neq)
So, I decided to make the type definitions of the dummy variables the same as outside the subroutine as below. Doing this leads to a segmentation fault in the !$ACC REGION directive with the following output from the debugger:
0x4E0474: 8B 48 34 movl 52(%rax),%ecx
So, I decided to add the known array bounds and explicitly declare the various arrays as copyin, copyout and local as shown in the Staggered Leapfrog example. Doing so results in the following error messages from pgfortran:
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 78)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 79)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 80)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 81)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 82)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 83)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 84)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 85)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 86)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 87)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 88)
PGF90-S-0155-Unexpected continuation (bicgstab_a_gpu.f95: 89)
Which is one for every !$ACC& line I’ve added after !$ACC REGION
Any ideas what I might be doing incorrectly?
subroutine bicgstab_a_gpu(neq,mxstif,max_iter,errmax,ia,ja,a,b,x)
use files_mod, only : ilog
implicit none
! Dummy definitions
integer neq
integer mxstif
integer max_iter
integer, dimension(:), allocatable :: ia
integer, dimension(:), allocatable :: ja
double precision, dimension(:), allocatable :: a
double precision, dimension(:), allocatable :: b
double precision, dimension(:), allocatable :: x
! Locals
double precision r(neq)
double precision rt0(neq)
double precision vn(neq)
double precision tn(neq)
double precision error,rhoold,rhonew,enorm
double precision omega
integer iter
!locals for matvec loop
integer loc1, loc2, i, j, k, ncol
double precision, parameter :: zero = 0.0d0
double precision, parameter :: tolzero = 1.d-25
double precision rmag
double precision bmag
double precision enumr
double precision denom
double precision alpha
double precision beta
double precision errmax
!======================
! ... initial [a]{x}
!======================
!$ACC REGION
!$ACC& LOCAL (rt0(1:neq),
!$ACC& tn(1:neq),
!$ACC& r(1:neq),
!$ACC& vn(1:neq)
!$ACC& ) COPY (
!$ACC& b(1:neq),
!$ACC& x(1:neq)
!$ACC& ) COPYIN (
!$ACC& ia(1:neq+1),
!$ACC& ja(1:mxstif),
!$ACC& a(1:mxstif)
!$ACC& )
rmag = 0.0d0
bmag = 0.0d0
success = .true.
converged = .false.
quit = .false.
error = errmax * 2
!$ACC DO VECTOR(32)
do i = 1, neq
loc1 = ia(i)
loc2 = ia(i + 1)
ncol = loc2 - loc1
r(i) = 0.0d0
do k = 1, ncol
r(i) = r(i) + a(loc1 + k) * x(ja(loc1 + k))
end do
end do
!... lots more code...
!$ACC END REGION