Hello.
I’m trying to compile and execute next code:
1.cuf :
module fluid
type omg
real, allocatable :: sad(:)
real, allocatable :: saf
end type
end module
program broken_derivative_types
use cudafor
use cudadevice
use fluid
implicit none
integer :: istat
type (omg) :: h
type (omg), device :: d
real, allocatable, device :: d_z(:)
real, allocatable :: h_z(:)
print *, "dbg"
istat = cudaMalloc(d_z, 10)
allocate(h_z(10))
d_z = 10.0
h_z = d_z
print *, h_z
print *, "dbg2"
allocate(h%sad(10))
print *, "dbg3"
istat = cudaMalloc(d%sad, 10)
allocate(d%sad(10))
print *, "istat: ", istat
d%sad = 10.0
print *, "dbg4"
h%sad = d%sad
print *, h%sad
end program broken_derivative_types
Here is the output:
dbg
10.00000 10.00000 10.00000 10.00000
10.00000 10.00000 10.00000 10.00000
10.00000 10.00000
dbg2
dbg3
0: copyout Memcpy (host=0xbfc5de10, dev=0x809d3c4, size=76) FAILED: 11(invalid argument)
And if I uncomment this line:
! istat = cudaMalloc(d%sad, 10)
Then I get next error from compiler:
PGF90-S-0155-Could not resolve generic procedure cudamalloc (1.cuf: 30)
0 inform, 0 warnings, 1 severes, 0 fatal for broken_derivative_types
pgfortran version is 11.9:
pgfortran 11.9-0 32-bit target on x86 Linux -tp core2
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc. All Rights Reserved.
PGF90/x86 Linux 11.9-0
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc. All Rights Reserved.
If this possible, I want to see, where did I make error (and see correct code for managing memory with derivative types).
Thanks in advance.