Sorry if this is a repeat of a previous post, I recall a discussion along these lines but couldn’t find the post.
The package I work on has recently undergone a significant rewrite in order to use derived types and I am merging those changes with the GPU implementation of the code.
Unfortunately I have had to hack my way around a host based “array of structures” by copying to a temporary array*. Other situations, where the derived type is used directly, are copied without issue - it is just this array of structures that is a problem.
I was hoping you could give me some brief feedback/links to further information regarding expected issues and best practises for derived types and OpenACC/CUDA Fortran.
*Just to clarify, only a subarray of the derived type is passed to the GPU, not the entire structure. However, this is then passed to the routine that does the host>device copy as follows:
subroutine routineA call routineB(derivedtype%array) end subroutine routineA subroutine routineb(array) istat = cudaMemcopyAsync(array, etc...) end subroutine routineb
Debugging the code that uses derived types in this manner results in a memcopy error that suggests an issue with the host array as the memory location is 0x0.