Dear forum,
While this f90/openacc code compiles and runs fine:
program x
...
!$acc data copyin(p)
!$acc enter data copyin(p%rho)
call mysub(p)
!$acc exit data copyout(p%rho)
!$acc end data
print *,particles%rho(1)
end program x
subroutine mysub(p)
!$acc kernels &
!$acc present( p, p%rho )
do i=1,n
p%rho(i) = 1.0
enddo
!$acc end kernels
end subroutine mysub
where p is declared as:
type fluid
real, allocatable :: rho(:)
end type fluid
type(fluid) :: p
-------------------------
We would like to do the same using:
!$acc data copyin(p)
!$acc enter data copyin(p%rho)
!$acc kernels & <-----------
!$acc present( p, p%rho ) <-----------
call mysub(p)
!$acc end kernels <-----------
!$acc exit data copyout(p%rho)
!$acc end data
print *,particles%rho(1)
subroutine mysub(p)
!$acc routine gang
...
!commentout !$acc kernels &
!commentout !$acc present( p, p%rho )
do i=1,n
p%rho(i) = 1.0
enddo
!commentout !$acc end kernels
end subroutine mysub
Both codes are compiled with: -acc -ta=nvidia:cc35, the last version gives wrong result.
Is there a way to do this ?
jg.