Skip to content

Commit

Permalink
SCREAM: changed cmake var NetCDF_<LANG>_PATHS to NetCDF_<LANG>_PATH
Browse files Browse the repository at this point in the history
The former can be overwritten by scorpio if certain MPI_<LANG>_XYZ
vars are non-empty. The latter is guaranteed to be honored.

See E3SM-Project/scorpio#456 for more details.
  • Loading branch information
bartgol committed Feb 25, 2022
1 parent 56f6427 commit 33de430
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions components/scream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if (NF_CONFIG_SEARCH)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (NF_STATUS EQUAL 0)
set(DEFAULT_NetCDF_Fortran_PATHS ${NF_CONFIG_OUTPUT})
set(DEFAULT_NetCDF_Fortran_PATH ${NF_CONFIG_OUTPUT})
endif()
endif()

Expand All @@ -183,7 +183,7 @@ if (NC_CONFIG_SEARCH)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (NC_STATUS EQUAL 0)
set(DEFAULT_NetCDF_C_PATHS ${NC_CONFIG_OUTPUT})
set(DEFAULT_NetCDF_C_PATH ${NC_CONFIG_OUTPUT})
endif()
endif()

Expand All @@ -201,9 +201,9 @@ set(SCREAM_MPI_EXTRA_ARGS ${DEFAULT_MPI_EXTRA_ARGS} CACHE STRING "Options for mp
set(SCREAM_MPI_NP_FLAG ${DEFAULT_MPI_NP_FLAG} CACHE STRING "The mpirun flag for designating the total number of ranks")
set(SCREAM_LIB_ONLY ${DEFAULT_LIB_ONLY} CACHE BOOL "Only build libraries, no exes")
set(SCREAM_AUTOTESTER ${DEFAULT_AUTOTESTER} CACHE BOOL "This is an autotester run; may disable some tests")
set(NetCDF_Fortran_PATHS ${DEFAULT_NetCDF_Fortran_PATHS} CACHE FILEPATH "Path to netcdf fortran installation")
set(NetCDF_C_PATHS ${DEFAULT_NetCDF_C_PATHS} CACHE FILEPATH "Path to netcdf C installation")
set(SCREAM_MACHINE $DEFAULT_SCREAM_MACHINE CACHE STRING "The CIME/SCREAM name for the current machine")
set(NetCDF_Fortran_PATH ${DEFAULT_NetCDF_Fortran_PATH} CACHE FILEPATH "Path to netcdf fortran installation")
set(NetCDF_C_PATH ${DEFAULT_NetCDF_C_PATH} CACHE FILEPATH "Path to netcdf C installation")
set(SCREAM_MACHINE ${DEFAULT_SCREAM_MACHINE} CACHE STRING "The CIME/SCREAM name for the current machine")

# Handle input root
if (SCREAM_MACHINE)
Expand Down
2 changes: 1 addition & 1 deletion components/scream/cmake/BuildCprnc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro(BuildCprnc)
set(SCC ${CMAKE_C_COMPILER})
set(SFC ${CMAKE_Fortran_COMPILER})
set(FFLAGS \"${CMAKE_Fortran_FLAGS}\")
set(NETCDF_PATH ${NetCDF_Fortran_PATHS})
set(NETCDF_PATH ${NetCDF_Fortran_PATH})
"
)
set(SRC_ROOT ${SCREAM_BASE_DIR}/../..)
Expand Down
2 changes: 1 addition & 1 deletion components/scream/cmake/machine-files/lassen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set (EKAT_MACH_FILES_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../../externals/ekat/cmake/machine-files)
include (${EKAT_MACH_FILES_PATH}/kokkos/nvidia-v100.cmake)
include (${EKAT_MACH_FILES_PATH}/kokkos/cuda.cmake)
set(NetCDF_Fortran_PATHS /usr/gdata/climdat/libs/netcdf-fortran/install/lassen/fortran CACHE STRING "")
set(NetCDF_Fortran_PATH /usr/gdata/climdat/libs/netcdf-fortran/install/lassen/fortran CACHE STRING "")
set(BLAS_LIBRARIES /usr/gdata/climdat/libs/blas/libblas.a CACHE STRING "")
set(LAPACK_LIBRARIES /usr/gdata/climdat/libs/lapack/liblapack.a CACHE STRING "")
set(SCREAM_MPIRUN_EXE "jsrun -E LD_PRELOAD=/opt/ibm/spectrum_mpi/lib/pami_471/libpami.so" CACHE STRING "")
Expand Down
4 changes: 2 additions & 2 deletions components/scream/scripts/test_all_scream.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ def generate_cmake_config(self, extra_configs, for_ctest=False):
# even if no netcdf is available
stat, f_path, _ = run_cmd("nf-config --prefix")
if stat == 0:
result += " -DNetCDF_Fortran_PATHS={}".format(f_path)
result += " -DNetCDF_Fortran_PATH={}".format(f_path)
stat, c_path, _ = run_cmd("nc-config --prefix")
if stat == 0:
result += " -DNetCDF_C_PATHS={}".format(c_path)
result += " -DNetCDF_C_PATH={}".format(c_path)

# Test-specific cmake options
for key, value in extra_configs:
Expand Down
4 changes: 2 additions & 2 deletions components/scream/src/physics/rrtmgp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ set(INTERFACE_SRC
rrtmgp_test_utils.cpp
)
add_library(scream_rrtmgp ${INTERFACE_SRC})
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATHS}/lib)
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATH}/lib)
target_link_libraries(scream_rrtmgp PUBLIC ${NETCDF_C} rrtmgp yakl scream_share physics_share share_util)
target_include_directories(scream_rrtmgp SYSTEM PUBLIC
${NetCDF_C_PATHS}/include ${SCREAM_BASE_DIR}/../../externals ${EAM_RRTMGP_DIR}/external)
${NetCDF_C_PATH}/include ${SCREAM_BASE_DIR}/../../externals ${EAM_RRTMGP_DIR}/external)

# Build tests
if (NOT SCREAM_LIB_ONLY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include (BuildCprnc)
BuildCprnc()

# Needed for RRTMGP
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATHS}/lib)
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATH}/lib)
# Get or create the dynamics lib
# HOMME_TARGET NP PLEV QSIZE_D
CreateDynamicsLib("theta-l_kokkos" 4 72 35)
Expand Down
2 changes: 1 addition & 1 deletion components/scream/tests/uncoupled/rrtmgp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (NOT ${SCREAM_BASELINES_ONLY})

SET (TEST_LABELS "rrtmgp;physics")
# Required libraries
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATHS}/lib)
find_library(NETCDF_C netcdf HINTS ${NetCDF_C_PATH}/lib)
set (NEED_LIBS scream_rrtmgp rrtmgp ${NETCDF_C} scream_control scream_share physics_share yakl)

CreateUnitTest(
Expand Down

0 comments on commit 33de430

Please sign in to comment.