Hi all, I am a newbie to the domain of HPC, and recently I met a problem of copying device data within a host subroutine. The simplest code is given as below
program test
use cudafor
implicit none
integer::p1(4,4)=0
integer,device::a1,b1(4),dp1(4,4)
dp1=p1
b1(1:4)=dp1(2,1:4)
a1=dp1(3,2)
end program
And the nvfortran compiler throws an error as below
user@node:~/$ nvfortran test.cuf
NVFORTRAN-S-0519-More than one device-resident object in assignment (test.cuf: 8)
0 inform, 0 warnings, 1 severes, 0 fatal for test
It seems that a value in a device array cannot be assigned to a single number allocated on the device. And I do not think it is efficient to write a kernel subroutine just to copy out a single value from a large array.
I’ve seen some posts talked about the same problem, but unfortunately did not find any useful solutions.
I’d like to know if anyone can tell me how to solve this problem?
Thanks a lot!