Hi, all
I try to allocate derived type array on gpu device. However, I will get the compiling message “error S0155 : more than one device-resident object in assignment” while the statement is “allocate( g_cf(i)%a(0:j), g_cf(i)%b(0:j) )”.
And I got the runtime message “Process 0: Signalled ACCESS_VIOLATION at 0x40001c8e” while using the statement instead “allocate( g_cf(i)%a(j+1), g_cf(i)%b(j+1) )”.
I’ve tried it using PVF 10.9 on WIN 7 and 12.3 on Linux.
Did I do anything wrong?
Thank you.
program prog
use cudafor
implicit none
! Variables
Type g_ch
integer :: cst
real*8,allocatable :: a(:)
integer,allocatable :: b(:)
End type
Type(g_ch),allocatable,device :: g_cf(:)
Type(g_ch),allocatable ::cf(:)
Integer::num, i, j
num=10
allocate( cf(num) )
do i=1,num
cf(i)%cst=i+num
allocate( cf(i)%a(0:cf(i)%cst), cf(i)%b(0:cf(i)%cst) )
end do
allocate( g_cf(num) )
do i=1,num
g_cf(i)%cst=cf(i)%cst
j=g_cf(i)%cst
allocate( g_cf(i)%a(0:j), g_cf(i)%b(0:j) )
!allocate( g_cf(i)%a(j+1), g_cf(i)%b(j+1) )
end do
end program prog
cyfeng