forked from ufs-community/ufs-weather-model
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support IntelLLVM compiler (ufs-community#2224)
* UFSWM - Add support for Intel LLVM compiler * CICE - Add support for Intel LLVM compiler * FV3 - Add support for Intel LLVM compiler * ccpp-physics - Add support for Intel LLVM compiler * atmos_cubed_sphere - Add support for Intel LLVM compiler * upp - Add support for Intel LLVM compiler * WW3 - Add support for Intel LLVM compiler
- Loading branch information
1 parent
2ccc549
commit bad50ef
Showing
32 changed files
with
3,113 additions
and
2,904 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule CICE
updated
49 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,118 @@ | ||
### CICE Fortran compiler flags | ||
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian -ffree-line-length-none ") | ||
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") | ||
endif() | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -Wall -Wextra -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) | ||
set(CMAKE_Fortran_LINK_FLAGS "" ) | ||
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -FR -convert big_endian -assume byterecl -ftz -align array64byte") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -init=snan,arrays") | ||
set(CMAKE_Fortran_LINK_FLAGS "") | ||
else() | ||
message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options") | ||
endif() | ||
|
||
### CICE C compiler flags | ||
if(CMAKE_C_COMPILER_ID MATCHES "GNU") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") | ||
set(CMAKE_C_FLAGS_RELEASE "-O3") | ||
set(CMAKE_C_FLAGS_DEBUG "-O0") | ||
set(CMAKE_C_LINK_FLAGS "") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") | ||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -traceback") | ||
set( CMAKE_C_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set( CMAKE_C_FLAGS_DEBUG "-O0 -ftrapuv") | ||
set( CMAKE_C_LINK_FLAGS "") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") | ||
set( CMAKE_C_FLAGS_RELEASE "-O3" ) | ||
set( CMAKE_C_FLAGS_DEBUG "-O0" ) | ||
set( CMAKE_C_LINK_FLAGS "" ) | ||
else() | ||
message(WARNING "C compiler with ID ${CMAKE_C_COMPILER_ID} will be used with CMake default options") | ||
endif() | ||
|
||
# Configuration Options | ||
set(CICE_IO "PIO" CACHE STRING "CICE OPTIONS: Choose IO options.") | ||
set_property(CACHE CICE_IO PROPERTY STRINGS "NetCDF" "PIO" "Binary") | ||
|
||
# Too many files to list, so include them via this file | ||
include("cice_files.cmake") | ||
|
||
# Collect source files for library | ||
list(APPEND lib_src_files | ||
${cice_shared_files} | ||
${cice_shared_files_c} | ||
${icepack_files} | ||
${cice_mpi_comm_files} | ||
${cice_nuopc_cmeps_driver_files} | ||
${cice_cdeps_inline_files}) | ||
|
||
list(APPEND _cice_defs FORTRANUNDERSCORE | ||
coupled) | ||
|
||
# Select IO source files based on CICE_IO | ||
if(CICE_IO MATCHES "NetCDF") | ||
list(APPEND lib_src_files ${cice_netcdf_io_files}) | ||
list(APPEND _cice_defs USE_NETCDF) | ||
elseif(CICE_IO MATCHES "PIO") | ||
list(APPEND lib_src_files ${cice_pio2_io_files}) | ||
list(APPEND _cice_defs USE_NETCDF) | ||
elseif(CICE_IO MATCHES "Binary") | ||
list(APPEND lib_src_files ${cice_binary_io_files}) | ||
endif() | ||
|
||
### Create target library and set PUBLIC interfaces on the library | ||
add_library(cice STATIC ${lib_src_files}) | ||
set_target_properties(cice PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) | ||
target_compile_definitions(cice PUBLIC "${_cice_defs}") | ||
target_include_directories(cice PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod> | ||
$<INSTALL_INTERFACE:mod>) | ||
target_link_libraries(cice PUBLIC esmf) | ||
if(CICE_IO MATCHES "^(NetCDF|PIO)$") | ||
target_link_libraries(cice PUBLIC NetCDF::NetCDF_Fortran) | ||
if(CICE_IO MATCHES "PIO") | ||
target_link_libraries(cice PUBLIC PIO::PIO_Fortran) | ||
endif() | ||
endif() | ||
if(OpenMP_Fortran_FOUND) | ||
target_link_libraries(cice PRIVATE OpenMP::OpenMP_Fortran) | ||
endif() | ||
|
||
# ice prescribed | ||
add_dependencies(cice cdeps::cdeps) | ||
target_compile_definitions(cice PUBLIC "DISABLE_FoX") | ||
target_link_libraries(cice PUBLIC cdeps::cdeps) | ||
|
||
############################################################################### | ||
### Install | ||
############################################################################### | ||
|
||
install( | ||
TARGETS cice | ||
EXPORT cice-config | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
COMPONENT Library) | ||
|
||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX}/CICE) | ||
|
||
install(EXPORT cice-config | ||
DESTINATION lib/cmake) | ||
### CICE Fortran compiler flags | ||
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian -ffree-line-length-none ") | ||
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") | ||
endif() | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -Wall -Wextra -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) | ||
set(CMAKE_Fortran_LINK_FLAGS "" ) | ||
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -FR -convert big_endian -assume byterecl -ftz -align array64byte") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -init=snan,arrays") | ||
set(CMAKE_Fortran_LINK_FLAGS "") | ||
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -FR -convert big_endian -assume byterecl -ftz -align array64byte") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -init=snan,arrays") | ||
set(CMAKE_Fortran_LINK_FLAGS "") | ||
else() | ||
message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options") | ||
endif() | ||
|
||
### CICE C compiler flags | ||
if(CMAKE_C_COMPILER_ID MATCHES "GNU") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") | ||
set(CMAKE_C_FLAGS_RELEASE "-O3") | ||
set(CMAKE_C_FLAGS_DEBUG "-O0") | ||
set(CMAKE_C_LINK_FLAGS "") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") | ||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -traceback") | ||
set( CMAKE_C_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set( CMAKE_C_FLAGS_DEBUG "-O0 -ftrapuv") | ||
set( CMAKE_C_LINK_FLAGS "") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "^(IntelLLVM)$") | ||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -traceback") | ||
set( CMAKE_C_FLAGS_RELEASE "-O2 -fp-model precise") | ||
set( CMAKE_C_FLAGS_DEBUG "-O0") | ||
set( CMAKE_C_LINK_FLAGS "") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") | ||
set( CMAKE_C_FLAGS_RELEASE "-O3" ) | ||
set( CMAKE_C_FLAGS_DEBUG "-O0" ) | ||
set( CMAKE_C_LINK_FLAGS "" ) | ||
else() | ||
message(WARNING "C compiler with ID ${CMAKE_C_COMPILER_ID} will be used with CMake default options") | ||
endif() | ||
|
||
# Configuration Options | ||
set(CICE_IO "PIO" CACHE STRING "CICE OPTIONS: Choose IO options.") | ||
set_property(CACHE CICE_IO PROPERTY STRINGS "NetCDF" "PIO" "Binary") | ||
|
||
# Too many files to list, so include them via this file | ||
include("cice_files.cmake") | ||
|
||
# Collect source files for library | ||
list(APPEND lib_src_files | ||
${cice_shared_files} | ||
${cice_shared_files_c} | ||
${icepack_files} | ||
${cice_mpi_comm_files} | ||
${cice_nuopc_cmeps_driver_files} | ||
${cice_cdeps_inline_files}) | ||
|
||
list(APPEND _cice_defs FORTRANUNDERSCORE | ||
coupled) | ||
|
||
# Select IO source files based on CICE_IO | ||
if(CICE_IO MATCHES "NetCDF") | ||
list(APPEND lib_src_files ${cice_netcdf_io_files}) | ||
list(APPEND _cice_defs USE_NETCDF) | ||
elseif(CICE_IO MATCHES "PIO") | ||
list(APPEND lib_src_files ${cice_pio2_io_files}) | ||
list(APPEND _cice_defs USE_NETCDF) | ||
elseif(CICE_IO MATCHES "Binary") | ||
list(APPEND lib_src_files ${cice_binary_io_files}) | ||
endif() | ||
|
||
### Create target library and set PUBLIC interfaces on the library | ||
add_library(cice STATIC ${lib_src_files}) | ||
set_target_properties(cice PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) | ||
target_compile_definitions(cice PUBLIC "${_cice_defs}") | ||
target_include_directories(cice PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod> | ||
$<INSTALL_INTERFACE:mod>) | ||
target_link_libraries(cice PUBLIC esmf) | ||
if(CICE_IO MATCHES "^(NetCDF|PIO)$") | ||
target_link_libraries(cice PUBLIC NetCDF::NetCDF_Fortran) | ||
if(CICE_IO MATCHES "PIO") | ||
target_link_libraries(cice PUBLIC PIO::PIO_Fortran) | ||
endif() | ||
endif() | ||
if(OpenMP_Fortran_FOUND) | ||
target_link_libraries(cice PRIVATE OpenMP::OpenMP_Fortran) | ||
endif() | ||
|
||
# ice prescribed | ||
add_dependencies(cice cdeps::cdeps) | ||
target_compile_definitions(cice PUBLIC "DISABLE_FoX") | ||
target_link_libraries(cice PUBLIC cdeps::cdeps) | ||
|
||
############################################################################### | ||
### Install | ||
############################################################################### | ||
|
||
install( | ||
TARGETS cice | ||
EXPORT cice-config | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
COMPONENT Library) | ||
|
||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX}/CICE) | ||
|
||
install(EXPORT cice-config | ||
DESTINATION lib/cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -qno-opt-dynamic-align") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align -fp-model precise") | ||
|
||
# warning #5462: Global name too long. | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 5462") | ||
|
||
# remark #7712: This variable has not been used. | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 7712") | ||
|
||
# remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 8291") | ||
|
||
# warning #5194: Source line truncated. | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 5194") | ||
|
||
if(CMAKE_Platform STREQUAL "derecho.intel") | ||
set(CMAKE_Fortran_LINK_FLAGS "-Wl,--copy-dt-needed-entries") | ||
endif() | ||
|
||
if(NOT 32BIT) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 64") | ||
endif() | ||
|
||
if(DEBUG) | ||
add_definitions(-DDEBUG) | ||
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug minimal -ftrapuv -init=snan,arrays") | ||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -ftrapuv") | ||
else() | ||
if(FASTER) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -fp-model precise -assume buffered_stdout -fno-alias -align all -debug minimal -qoverride-limits -ftz") | ||
set(CMAKE_C_FLAGS_RELEASE "-O3 -fp-model precise -debug minimal -qoverride-limits -ftz") | ||
else() | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -qoverride-limits") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fp-model precise") | ||
set(CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal") | ||
endif() | ||
if(AVX2) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -march=core-avx2") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=core-avx2") | ||
elseif(SIMDMULTIARCH) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -axSSE4.2,CORE-AVX2") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -axSSE4.2,CORE-AVX2") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mcmodel=medium") | ||
elseif(AVX) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -march=core-avx-i") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=core-avx-i") | ||
endif() | ||
endif() | ||
|
||
if(APPLE) | ||
# The linker on macOS does not include `common symbols` by default | ||
# Passing the -c flag includes them and fixes an error with undefined symbols | ||
set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> -c <TARGET>") | ||
endif() | ||
|
||
# This must be last, to override all other optimization settings. | ||
if(DISABLE_FMA) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -no-fma") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -no-fma") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(PARALLEL_NETCDF ON CACHE BOOL "Enable parallel NetCDF" FORCE) | ||
set(AVX2 OFF CACHE BOOL "Enable AVX2 instruction set" FORCE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.