@@ -6,6 +6,12 @@ enable_testing()
6
6
7
7
set (CMAKE_CXX_STANDARD 11)
8
8
9
+ option (OPENACC "Enable OpenACC support" OFF )
10
+ option (OPENMP "Enable OpenMP support" ON )
11
+ option (OPENMP_OFFLOAD "Enable OpenMP offloading to GPU support" OFF )
12
+ option (ROCM "Enable ROCm, offloading to MI100 using OpenMPI 4.5" OFF )
13
+ option (INTEL_ANALYZER "Add compiler options for Intel Analyzer" OFF )
14
+
9
15
set (OPT_FLAGS "" CACHE STRING "compiler optimization flags" )
10
16
11
17
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_FLAGS} " )
@@ -26,12 +32,7 @@ set(NUM_PROCS "4" CACHE STRING "Number of processes when running tests")
26
32
27
33
set (EXTRA_LIBS "" CACHE STRING "Extra libraries to link against" )
28
34
29
- option (OPENACC "Enable OpenACC support" OFF )
30
- option (OPENMP_OFFLOAD "Enable OpenMP offloading to GPU support" OFF )
31
- option (ROCM "Enable ROCm, offloading to MI100 using OpenMPI 4.5" OFF )
32
- option (INTEL_ANALYZER "Add compiler options for Intel Analyzer" OFF )
33
-
34
- set (ROCM_COMPILER_PATH "/opt/rocm/llvm/bin" CACHE STRING "Path to the ROCm compilers (only used ith ROCM is set)" )
35
+ set (ROCM_COMPILER_PATH "/opt/rocm/llvm/bin" CACHE STRING "Path to the ROCm compilers (only used if ROCM is set)" )
35
36
if (${ROCM} )
36
37
list (APPEND CMAKE_PREFIX_INSTALL /opt/rocm/hip /opt/rocm)
37
38
set (CMAKE_CXX_COMPILER "${ROCM_COMPILER_PATH} /clang++" )
@@ -90,14 +91,15 @@ if ((NOT OPENACC) AND OPENMP_FOUND)
90
91
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS} " )
91
92
else ()
92
93
# OpenACC is incompatible with OpenMP, either one or the other or none
93
- if (OPENACC AND ("${CMAKE_CXX_COMPILER_ID} " MATCHES "^NVHPC|PGI" ))
94
+ if (OPENACC)
95
+ if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "^NVHPC|PGI" )
96
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -acc -Minfo=acc" )
97
+ message (STATUS "Using PGI or Nvidia C++ compiler, added OpenACC compiler switches" )
98
+ elseif ("${CMAKE_CXX_COMPILER_ID} " MATCHES "^GNU" )
99
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenacc -fopt-info-optimized-omp" )
100
+ message (STATUS "Using GNU C++ compiler, added OpenACC compiler switches" )
101
+ endif ()
94
102
message (STATUS "OpenACC enabled" )
95
- # These are the PGI openACC flags -- need to find out what the
96
- # corresponding options are for the CRAY, gcc, ... compilers
97
- # (if they exist)
98
- #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -acc -Minfo=acc")
99
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -acc -Minfo=acc" )
100
- #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -acc -Minfo=acc")
101
103
endif ()
102
104
endif ()
103
105
0 commit comments