cmake: fix and extend openmp support #105
Open
aoymt wants to merge 3 commits intosissaschool:develfrom
Open
Conversation
Contributor
|
Hi, is it also possible to compile CPU code without openMP? That would be useful for workloads where multi-threading is not benficial. |
Author
|
How about introducing a cmake option EXT_OPENMP? To build the code without OpenMP, the option "-DEXT_OPENMP=OFF" would be passed to cmake (assuming that openmp is enabled by default). |
Contributor
|
That would be ok for me! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes and extends OpenMP configuration for the GNU, Intel (Legacy), and Intel oneAPI compilers. It enables OpenMP when GPU is disabled and avoids OpenMP detection issues with Intel compilers.
GNU compiler (
cmake/compilers/GNU/CMakeLists.txt)-fopenmpfor Fortran and C (compile and link) in the non-GPU path.Intel Legacy compiler (
cmake/compilers/intel/CMakeLists.txt)add_fortran_flag_if_avail("-qopenmp")/add_c_flag_if_avail,-qopenmpis now set per target viatarget_compile_optionsandtarget_link_options.check_fortran_compiler_flag/check_c_compiler_flagfor OpenMP, which can require-qopenmpat link time.-qopenmpoptions.Intel oneAPI compiler (
cmake/compilers/oneapi/CMakeLists.txt)-qopenmpis added for both Fortran and C so that oneAPI builds enable OpenMP correctly.cf. #104