Are derived types containing allocatable arrays supported in any existing OpenACC compilers?

StackOverflow https://stackoverflow.com/questions/21552531

  •  06-10-2022
  •  | 
  •  

سؤال

Are there any OpenAcc compilers that support the copying of derived types containing allocatable arrays to/from the GPU and their use in accelerated code?

The OpenACC spec (v2.0) states this is possible, but I'm unable to find it implemented in a compiler anywhere. The PGI compiler supports derived types, but seemingly not those containing allocatable arrays (see this page on the PGI forum). While this may have changed since them, it doesn't seem to be publicised (well) anywhere.

هل كانت مفيدة؟

المحلول

For now I'm unable to access the Cray or CAPS compilers, and the PGI compiler does not support this functionality. A suitable workaround seems to be to create a pointer to the allocatable array within the derived type and copy that to the GPU using the copy clause. If future versions of the PGI compiler support this kind of deep copy then I'll update the answer.

نصائح أخرى

Where do you think OpenACC 2.0 states this?

The relative references I find in Version 2.0 June, 2013 are:

Page 13 "Full support for Fortran derived types and derived type members, including allocatable and pointer members."

Page 26-27 "In Fortran, if a variable or array with derived type is specified, all the members of that derived type are allocated and copied, as appropriate. If any member has the OpenACC Programming Interface 27 allocatable or pointer attribute, the data accessed through that member are not copied."

The second reference explicitly states that copying the memory for allocatable and pointer objects inside of a derived type is not supported at this time.

The technical committee is working on "fixing this issue", however, the solution has not been released.

Cray provides a command line option to turn on support for "deep copy". This is a Cray extension and as such is not a portable solution.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top