Moving device data

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
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!

While CUDA Fortran does allow some data transfer via array syntax, it is limited. See: CUDA Fortran Programming Guide Version 21.7 for ARM, OpenPower, x86

For move complex data transfers, including device-to-device, you’ll want to look at using the cudaMemCpy routines:

Do be mindful with using array slices since the data transfers must be contiguous.

Thanks for your reply!

I’ve fixed the problem using pointers. Like


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.