Skip to content

Commit

Permalink
Merge branch 'develop' into feature/mathomp4/add-milan-support
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 authored Jan 19, 2024
2 parents ff42a84 + 61b2081 commit 4c1da8a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added detection of AMD Milan chips for GNU flags
- Added support for Hygon processors with Intel Fortran

### Changed

Expand Down
11 changes: 11 additions & 0 deletions compiler/flags/IntelLLVM_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,23 @@ set (NO_RANGE_CHECK "")

cmake_host_system_information(RESULT proc_description QUERY PROCESSOR_DESCRIPTION)
if (${proc_description} MATCHES "EPYC")
# AMD EPYC processors support AVX2, but only via the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
elseif (${proc_description} MATCHES "Hygon")
# Hygon processors support AVX2, but only via the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
elseif (${proc_description} MATCHES "Intel")
# All the Intel processors that GEOS runs on support AVX2, but to be
# consistent with the AMD processors, we use the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
# Previous versions of GEOS used this flag, which was not portable
# for AMD. Keeping here for a few versions for historical purposes.
#set (COREAVX2_FLAG "-xCORE-AVX2")
elseif ( ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
# This is a fallback for when the above doesn't work. It should work
# for most x86_64 processors, but it is not guaranteed to be optimal.
message(WARNING "Unknown processory type. Defaulting to a generic x86_64 processor. Performance may be suboptimal.")
set (COREAVX2_FLAG "")
else ()
message(FATAL_ERROR "Unknown processor. Please file an issue at https://github.com/GEOS-ESM/ESMA_cmake")
endif ()
Expand Down
8 changes: 8 additions & 0 deletions compiler/flags/Intel_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ set (NO_RANGE_CHECK "")

cmake_host_system_information(RESULT proc_description QUERY PROCESSOR_DESCRIPTION)
if (${proc_description} MATCHES "EPYC")
# AMD EPYC processors support AVX2, but only via the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
elseif (${proc_description} MATCHES "Hygon")
# Hygon processors support AVX2, but only via the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
elseif (${proc_description} MATCHES "Intel")
# All the Intel processors that GEOS runs on support AVX2, but to be
# consistent with the AMD processors, we use the -march=core-avx2 flag
set (COREAVX2_FLAG "-march=core-avx2")
# Previous versions of GEOS used this flag, which was not portable
# for AMD. Keeping here for a few versions for historical purposes.
#set (COREAVX2_FLAG "-xCORE-AVX2")
elseif ( ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
# This is a fallback for when the above doesn't work. It should work
# for most x86_64 processors, but it is not guaranteed to be optimal.
message(WARNING "Unknown processory type. Defaulting to a generic x86_64 processor. Performance may be suboptimal.")
set (COREAVX2_FLAG "")
# Once you are in here, you are probably on Rosetta, but not required.
Expand Down

0 comments on commit 4c1da8a

Please sign in to comment.