Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hygon support for Intel Fortran #346

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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