Skip to content

Commit

Permalink
Add Hygon support for Intel Fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Jan 19, 2024
1 parent c72f3bc commit ab349ff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added support for Hygon processors with Intel Fortran

### Changed

### Deprecated
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 ab349ff

Please sign in to comment.