Skip to content

Commit

Permalink
Merge branch 'NCAR:main' into nssl_restart_ccn
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroTed authored May 9, 2022
2 parents 5eeee8d + 3405ff1 commit b3e0944
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(ccpp_physics

#------------------------------------------------------------------------------
set(PACKAGE "ccpp-physics")
set(AUTHORS "Grant Firl" "Dom Heinzeller" "Man Zhang" "Laurie Carson")
set(AUTHORS "Grant Firl" "Dom Heinzeller" "Man Zhang" "Mike Kavulich" "Chunxi Zhang")

#------------------------------------------------------------------------------
# Set OpenMP flags for C/C++/Fortran
Expand All @@ -20,7 +20,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Bitforbit" "Release" "Coverage")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "Coverage")
endif()

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,22 +145,21 @@ SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS}
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} ${OpenMP_Fortran_FLAGS}")

# Lower optimization for certain schemes when compiling with Intel in Release mode
if((CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "Bitforbit") AND
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
# Define a list of schemes that need lower optimization with Intel in Release mode
set(SCHEME_NAMES_LOWER_OPTIMIZATION module_sf_mynn.F90)
foreach(SCHEME_NAME IN LISTS SCHEME_NAMES_LOWER_OPTIMIZATION)
set(SCHEMES_TMP ${SCHEMES})
# Need to determine the name of the scheme with its path
list(FILTER SCHEMES_TMP INCLUDE REGEX ".*${SCHEME_NAME}$")
SET_SOURCE_FILES_PROPERTIES(${SCHEMES_TMP}
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} ${OpenMP_Fortran_FLAGS} -O1")
APPEND_STRING PROPERTY COMPILE_FLAGS
" ${CMAKE_Fortran_FLAGS_PHYSICS} ${OpenMP_Fortran_FLAGS} -O1")
endforeach()
endif()

# No optimization for certain schemes when compiling with Intel in Release mode
if((CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "Bitforbit") AND
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
# Define a list of schemes that can't be optimized with Intel in Release mode
set(SCHEME_NAMES_NO_OPTIMIZATION GFS_typedefs.F90)
foreach(SCHEME_NAME IN LISTS SCHEME_NAMES_NO_OPTIMIZATION)
Expand All @@ -174,8 +173,7 @@ endif()

# Reduce optimization for mo_gas_optics_kernels.F90 (to avoid an apparent compiler bug with Intel 19+)
if(${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90 IN_LIST SCHEMES_OPENMP_OFF AND
(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "Bitforbit") AND
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
SET_SOURCE_FILES_PROPERTIES(${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} -O1")
endif()
Expand Down
2 changes: 1 addition & 1 deletion physics/module_sf_mynn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter, &
DO I=its,ite
if( flag_iter(i) ) then
! DH* 20200401 - note. A weird bug in Intel 18 on hera prevents using the
! normal -O2 optimization in REPRO and PROD mode for this file. Not reproducible
! normal -O2 optimization in Release mode for this file. Not reproducible
! by every user, the bug manifests itself in the resulting wind speed WSPD(I)
! being -99.0 despite the assignments in lines 932 and 933. *DH
WSPD(I)=SQRT(U1D(I)*U1D(I)+V1D(I)*V1D(I))
Expand Down

0 comments on commit b3e0944

Please sign in to comment.