Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Reviewed compiler flags and improved the consistency, and added abili…
Browse files Browse the repository at this point in the history
…ty to turn off OpenMP SIMD directives when building for CPU-agnostic container
  • Loading branch information
daminton committed May 19, 2023
1 parent 22bad3d commit 922c3f0
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 137 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90)
# Set some options the user may choose
OPTION(USE_COARRAY "Use Coarray Fortran for parallelization of test particles" OFF)
OPTION(USE_OPENMP "Use OpenMP for parallelization" ON)
OPTION(USE_SIMD "Use SIMD vectorization" ON)

# Locate and set parallelization libraries. There are some CMake peculiarities
# taken care of here, such as the fact that the FindOpenMP routine doesn't know
Expand Down
31 changes: 13 additions & 18 deletions cmake/Modules/FindOpenMP_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,19 @@

INCLUDE (${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)

SET (OpenMP_Fortran_FLAG_CANDIDATES
#Intel
"-qopenmp"
#Intel windows
"/Qopenmp"
#Gnu
"-fopenmp"
#Portland Group
"-mp"
#Empty, if compiler automatically accepts openmp
" "
#Sun
"-xopenmp"
#HP
"+Oopenmp"
#IBM XL C/c++
"-qsmp"
)
IF (USE_SIMD)
SET (OpenMP_Fortran_FLAG_CANDIDATES
"-qopenmp" # Intel
"/Qopenmp" # Intel Windows
"-fopenmp" # GNU
)
ELSE ()
SET (OpenMP_Fortran_FLAG_CANDIDATES
"-qopenmp -qno-openmp-simd" # Intel
"/Qopenmp-simd-" # Intel Windows
"-fopenmp" # GNU
)
ENDIF (USE_SIMD)

IF (DEFINED OpenMP_Fortran_FLAGS)
SET (OpenMP_Fortran_FLAG_CANDIDATES)
Expand Down
Loading

0 comments on commit 922c3f0

Please sign in to comment.