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

Commit

Permalink
Adjusted flags to allow the containerized version to work on more CPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 23, 2023
1 parent 05aa725 commit f8265e2
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,23 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
Fortran "-pad" # Intel
"/Qpad" # Intel Windows

)
IF (CONTAINERIZE)
# There is some bug where -march=native doesn't work on Mac
IF(APPLE)
SET(GNUNATIVE "-mtune=generic")
ELSE()
SET(GNUNATIVE "-march=generic")
ENDIF()
ELSE ()
# There is some bug where -march=native doesn't work on Mac
IF(APPLE)
SET(GNUNATIVE "-mtune=native")
ELSE()
SET(GNUNATIVE "-march=native")
ENDIF()
ENDIF (CONTAINERIZE)



Expand All @@ -126,9 +142,7 @@ IF (USE_SIMD)
IF (CONTAINERIZE)
# Optimize for an old enough processor that it should run on most computers
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}"
Fortran "-xSANDYBRIDGE" # Intel
"/QxSANDYBRIDGE" # Intel Windows
${GNUNATIVE} # GNU
Fortran ${GNUNATIVE} # GNU
)
ELSE ()
# Optimize for the host's architecture
Expand All @@ -146,21 +160,6 @@ IF (USE_SIMD)
)
ENDIF (USE_SIMD)

IF (CONTAINERIZE)
# There is some bug where -march=native doesn't work on Mac
IF(APPLE)
SET(GNUNATIVE "-mtune=sandybridge")
ELSE()
SET(GNUNATIVE "-march=sandybridge")
ENDIF()
ELSE ()
# There is some bug where -march=native doesn't work on Mac
IF(APPLE)
SET(GNUNATIVE "-mtune=native")
ELSE()
SET(GNUNATIVE "-march=native")
ENDIF()
ENDIF (CONTAINERIZE)



Expand Down

0 comments on commit f8265e2

Please sign in to comment.