Fortran derived type on device

Dear NVIDIA experts,
If I want to use derived data type on GPU by using cuda frotran, for example, which one in the following is right (do the members in the type need device attribute)?

type:: mydata
integer,allocatable::data_a(:,:)
end type mydata

type(mydata),allocatable,device:: realdata(:)
type:: mydata
integer,allocatable,device::data_a(:,:)
end type mydata

type(mydata),allocatable,device:: realdata(:)

Thank you very much in advance!

1 Like

Yes, if you want to use the members on the device (inside a CUDA kernel), they need to be device or managed. The later slides of this talk should help with understanding how to deal with CUDA Fortran derived types: https://on-demand.gputechconf.com/gtc/2018/presentation/s8557-tricks-tips-timings-the-data-movement.pdf