@@ -75,16 +75,24 @@ if(CORENRN_ENABLE_GPU)
7575 message (FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with NVHPC compilers" )
7676 endif ()
7777 elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "XLClang" )
78- set (NVHPC_ACC_COMP_FLAGS "-qsmp=omp -qoffload -qreport" )
79- set (NVHPC_ACC_LINK_FLAGS "-qcuda -lcaliper" )
80-
81- if (CORENRN_ENABLE_OPENMP AND CORENRN_ENABLE_OPENMP_OFFLOAD)
78+ if (CORENRN_ACCELERATOR_OFFLOAD STREQUAL "OpenMP" )
79+ set (NVHPC_ACC_COMP_FLAGS "-qsmp=omp -qoffload -qreport" )
80+ set (NVHPC_ACC_LINK_FLAGS "-qcuda -lcaliper" )
8281 # Enable OpenMP target offload to GPU and if both OpenACC and OpenMP directives are available
8382 # for a region then prefer OpenMP.
84- add_compile_definitions (CORENRN_PREFER_OPENMP_OFFLOAD)
83+ add_compile_definitions (CORENEURON_PREFER_OPENMP_OFFLOAD)
84+ else ()
85+ message (FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with XLClang compilers" )
8586 endif ()
8687 elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
87- set (NVHPC_ACC_COMP_FLAGS "-fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Wno-unknown-cuda-version -I${CUDAToolkit_INCLUDE_DIRS} " )
88+ if (CORENRN_ACCELERATOR_OFFLOAD STREQUAL "OpenMP" )
89+ set (NVHPC_ACC_COMP_FLAGS "-fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Wno-unknown-cuda-version -I${CUDAToolkit_INCLUDE_DIRS} " )
90+ # Enable OpenMP target offload to GPU and if both OpenACC and OpenMP directives are available
91+ # for a region then prefer OpenMP.
92+ add_compile_definitions (CORENEURON_PREFER_OPENMP_OFFLOAD)
93+ else ()
94+ message (FATAL_ERROR "${CORENRN_ACCELERATOR_OFFLOAD} not supported with Clang compilers" )
95+ endif ()
8896 else ()
8997 message (FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} is not supported in GPU builds." )
9098 endif ()
0 commit comments