OpenACC copy Fortran user defined data types


I am getting errors while try to copy data.
In my fortran code, I have a data type defined like this:

type node
			integer(4) :: id
			real(dp), allocatable :: pos(:)
			real(dp), allocatable :: veloc(:)
			real(dp), allocatable :: accel(:)
end type node

I got this error:

Lowering Error: bad ast optype in expression [ast=1438,asttype=12,datatype=0]

while try to copy data into device memory:

!$acc data copyin(nodes(:)%pos(:))

How to copy this kind of data?


Hi Guanfeng,

OpenACC doesn’t yet support Fortran derived types that include allocatables or pointer members (See section 1.9 of the OpenACC 2.0 standard). It’s something the OpenACC language committee is working on defining in the next major OpenACC standard.

A potential work around is to create pointers to each of the “pos” arrays and mange them separately on the device.

  • Mat

Hi Mat,

Thanks for your reply.