Skip to content

Conversation

@olupton
Copy link

@olupton olupton commented Dec 17, 2021

Such function-local static variables are not supported by the NVIDIA HPC compilers with OpenMP offload.
Replace one such variable with (effectively) a namespace-global inline variable, but actually define this as a static template member so as not to require C++17 (for inline variables).

See also: https://forums.developer.nvidia.com/t/enabling-openmp-offload-breaks-openacc-code/196643

And declare the namespace-global version available on the target device
when compiling with OpenMP.
@olupton olupton changed the title Make function-local static var namespace-global. Avoid function-local static variables. Dec 21, 2021
@olupton olupton marked this pull request as ready for review December 21, 2021 12:40
Copy link

@ohm314 ohm314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@olupton olupton merged commit fadddd6 into extend_CUDA_support Dec 21, 2021
@olupton olupton deleted the olupton/openmp-compat branch December 21, 2021 13:37
olupton added a commit that referenced this pull request Dec 21, 2021
This reverts commit fadddd6, reversing
changes made to e5a8b02.
@olupton olupton mentioned this pull request Dec 21, 2021
olupton added a commit that referenced this pull request Dec 21, 2021
* Revert "Avoid function-local static variables. (#1)"
* Use static cache sizes if OpenMP or OpenACC is enabled with NVIDIA compilers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants