Reputation: 483
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.
Upvotes: 0
Views: 220
Reputation: 1279
As @Mat Colgrove pointed out, it is the expected behavior for the compiler to implicitly add data clauses for variables that do not appear in one. You can add default(none)
to your pragmas and this will instruct the compiler to give a compile-time error if a variable is used within the region and does not appear in a data clause. I'm not aware of a compiler option to do this program-wide though.
Upvotes: 1
Reputation: 5646
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.
Upvotes: 1