It says on p. 20 of the user guide:
An assignment statement with a device variable or device array or array section on both sides of the assignment statement will copy data between two device variables or arrays.
When I try this, however, I get the error:
more than one device-resident object in assignment
Example code:
program dev2dev
use cudafor
integer, device :: d1
integer, device :: d2
integer :: h
h = 1
d1 = h
d2 = d1
h = d2
write (*,*) h
end program dev2dev
[/quote]
Hi BeachHut,
Unfortunately, implementation is slightly behind the CUDA Fortran spec and this is one of the few features left. I’ll update this post once this is supported.
Thanks,
Mat
Hi BeachHut,
FYI, device to device copies will be supported in the 10.5 release.
This seems only partially fixed. If I use allocatables I still get an error.
dev2dev.cuf:
program dev2dev
use cudafor
integer, allocatable, device, dimension(:) :: d1
integer, allocatable, device, dimension(:) :: d2
allocate(d1(10))
allocate(d2(10))
d1(5) = 10
d2(5) = d1(5)
end program dev2dev
$ pgfortran dev2dev.cuf
PGF90-S-0155-more than one device-resident object in assignment (dev2dev.cuf: 13)
0 inform, 0 warnings, 1 severes, 0 fatal for dev2dev
This should work. I have duplicated the error and have filed a bug.