Hi,
I’ve found a problem on allocatable derived types with device attribute.
The test code is attached.
Compiling the code with CUDA Fortran from PGI Workstation 11.10 and CUDA4.0
the output of the executable is:
cudaSetDevice: istat = 0
allocate: istat = 0
3.141592653589793
3.141592653589793
3.141592653589793
3.141592653589793
However, compiling the code with CUDA Fortran from PGI Workstation 12.2 and CUDA4.0,
the output of the executable is:
cudaSetDevice: istat = 0
allocate: istat = 0
3.141592653589793
3.141592653589793
It seems that the arrays are not correctly allocated using v12.2.
The situation is the same both in Windows(64-bit) and Linux(64-bit).
Tetsuo
program TEST
use cudafor
implicit none
integer, parameter :: KRSZ = selected_real_kind(15)
type :: yield_
real(KRSZ) :: x_fin(1:10) = acos(-1.0_KRSZ)
end type yield_
type(yield_), allocatable, device :: yield(:)
real(KRSZ) :: rtmp
integer :: istat
istat = cudaSetDevice(0)
write(*,*) 'cudaSetDevice: istat =', istat
allocate( yield(1:2), STAT=istat )
write(*,*) 'allocate: istat =', istat
rtmp = yield(1)%x_fin( 1) ; write(*,*) rtmp
rtmp = yield(1)%x_fin(10) ; write(*,*) rtmp
rtmp = yield(2)%x_fin( 1) ; write(*,*) rtmp
rtmp = yield(2)%x_fin(10) ; write(*,*) rtmp
end program TEST