c++compiler-errorsgpuopenaccpgi

Disabling OpenACC implicit pragma generation with pgc++ compiler


I'm using the pgc++ compiler on some C++ code that uses OpenACC directives, and I was wondering if there is a compiler option to disable implicit pragma generation that is performed when compiling code if the user leaves the required pragmas out. For example, when compiling my own code with the -Minfo=accel flag, I see the following messages appear:

Generating implicit copy(beam_endpoint_grid_idx,beam_endpoint_world_frame[:]) [if not already present]
Generating implicit copyin(R[:][:]) [if not already present]
Generating implicit copyin(this[:],particle_position_world_frame[:]) [if not already present]

And what I'm trying to do is prevent the pgc++ compiler from producing these implicit copy(), copyin() etc. pragmas, and instead throw an error. Is such an option available?

Doing a search in the pgc++ man page, the only options that contained the word implicit in their name or in their description were,

--implicit_include (default) --no_implicit_include
--implicit_typename (default) --no_implicit_typename
--using_std (default) --no_using_std

But these unfortunately don't disable implicit pragma generation.


Solution

  • This is the default behavior as defined by the OpenACC standard when a user does not use data clauses on a compute construct (parallel/kernels). A runtime check is performed and if the data is already present on the device, no action is performed. If the data is not on the device, then the data is copied.

    You can add these variables to data clauses individually, or add a "default(present)" clause to your compute construct so all shared data will presumed to be present on the device. If the data is not present, then a runtime error will occur.