From 25b266e1206dee03b2b73859e39d2cc3cecb9b7d Mon Sep 17 00:00:00 2001 From: James Foucar Date: Tue, 4 Feb 2025 17:04:38 -0700 Subject: [PATCH] Some of the unit tests use a ton of memory, so add a pool multiplier option --- components/eamxx/cime_config/namelist_defaults_scream.xml | 1 + .../src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp | 5 ++++- .../eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp | 7 ++++--- components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp | 2 +- .../eamxx/tests/single-process/rrtmgp/CMakeLists.txt | 2 +- .../eamxx/tests/single-process/rrtmgp/input_unit.yaml | 1 + 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/eamxx/cime_config/namelist_defaults_scream.xml b/components/eamxx/cime_config/namelist_defaults_scream.xml index 599eaf110857..a59a571e6f6d 100644 --- a/components/eamxx/cime_config/namelist_defaults_scream.xml +++ b/components/eamxx/cime_config/namelist_defaults_scream.xml @@ -530,6 +530,7 @@ be lost if SCREAM_HACK_XML is not enabled. true + 1.0 diff --git a/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp b/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp index 370fc0bf7812..11e1151a2471 100644 --- a/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp +++ b/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp @@ -636,6 +636,8 @@ void RRTMGPRadiation::initialize_impl(const RunType /* run_type */) { m_n2vmr = m_params.get("n2vmr", 0.7906); m_covmr = m_params.get("covmr", 1.0e-7); + const double multiplier = m_params.get("pool_size_multiplier", 1.0); + // Whether or not to do MCICA subcolumn sampling m_do_subcol_sampling = m_params.get("do_subcol_sampling",true); @@ -676,7 +678,8 @@ void RRTMGPRadiation::initialize_impl(const RunType /* run_type */) { m_gas_concs_k, coefficients_file_sw, coefficients_file_lw, cloud_optics_file_sw, cloud_optics_file_lw, - m_atm_logger + m_atm_logger, + multiplier ); VALIDATE_KOKKOS(m_gas_concs, m_gas_concs_k); VALIDATE_KOKKOS(rrtmgp::k_dist_sw, interface_t::k_dist_sw_k); diff --git a/components/eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp b/components/eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp index c03a266f5ef1..3f8b0b99374f 100644 --- a/components/eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp +++ b/components/eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp @@ -214,13 +214,14 @@ static inline cloud_optics_t cloud_optics_lw_k; static inline bool initialized_k = false; /* - * Initialize data for RRTMGP driver + * Initialize data for RRTMGP driver. Increase multiplier to allocate more pool space. */ static void rrtmgp_initialize( const gas_concs_t &gas_concs, const std::string& coefficients_file_sw, const std::string& coefficients_file_lw, const std::string& cloud_optics_file_sw, const std::string& cloud_optics_file_lw, - const std::shared_ptr& logger) + const std::shared_ptr& logger, + const double multiplier = 1.0) { // If we've already initialized, just exit if (initialized_k) { @@ -246,7 +247,7 @@ static void rrtmgp_initialize( const size_t nlay = gas_concs.nlay; const size_t nlev = SCREAM_NUM_VERTICAL_LEV; const size_t my_size_ref = ncol * nlay * nlev; - pool_t::init(2e6 * (float(my_size_ref) / base_ref)); + pool_t::init(2e6 * (float(my_size_ref) / base_ref) * multiplier); // We are now initialized! initialized_k = true; diff --git a/components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp b/components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp index 76e7e45d6cdf..e0c93dfc980f 100644 --- a/components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp +++ b/components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp @@ -401,7 +401,7 @@ int run_kokkos(int argc, char** argv) { // Initialize absorption coefficients logger->info("Initialize RRTMGP...\n"); - interface_t::rrtmgp_initialize(gas_concs, coefficients_file_sw, coefficients_file_lw, cloud_optics_file_sw, cloud_optics_file_lw, logger); + interface_t::rrtmgp_initialize(gas_concs, coefficients_file_sw, coefficients_file_lw, cloud_optics_file_sw, cloud_optics_file_lw, logger, 2.0); // Setup our dummy atmosphere based on the input data we read in logger->info("Setup dummy atmos...\n"); diff --git a/components/eamxx/tests/single-process/rrtmgp/CMakeLists.txt b/components/eamxx/tests/single-process/rrtmgp/CMakeLists.txt index 8acb9b4038da..c8b57e98948b 100644 --- a/components/eamxx/tests/single-process/rrtmgp/CMakeLists.txt +++ b/components/eamxx/tests/single-process/rrtmgp/CMakeLists.txt @@ -18,7 +18,7 @@ if (SCREAM_ENABLE_BASELINE_TESTS AND NOT SCREAM_ONLY_GENERATE_BASELINES) CreateUnitTest(${TEST_BASE_NAME}_unit rrtmgp_standalone_unit.cpp LABELS rrtmgp physics driver LIBS scream_rrtmgp rrtmgp scream_control ${YAKL_LIB_NAME} diagnostics rrtmgp_test_utils - EXE_ARGS "--args --inputfile ${SCREAM_DATA_DIR}/init/rrtmgp-allsky.nc --baseline ${SCREAM_BASELINES_DIR}/data/rrtmgp-allsky-baseline.nc" + EXE_ARGS "--args --rrtmgp_inputfile ${SCREAM_DATA_DIR}/init/rrtmgp-allsky.nc --rrtmgp_baseline ${SCREAM_BASELINES_DIR}/data/rrtmgp-allsky-baseline.nc" ) endif() diff --git a/components/eamxx/tests/single-process/rrtmgp/input_unit.yaml b/components/eamxx/tests/single-process/rrtmgp/input_unit.yaml index 4a1f474c8778..92961fb30d99 100644 --- a/components/eamxx/tests/single-process/rrtmgp/input_unit.yaml +++ b/components/eamxx/tests/single-process/rrtmgp/input_unit.yaml @@ -21,6 +21,7 @@ atmosphere_processes: rrtmgp_coefficients_file_lw: ${SCREAM_DATA_DIR}/init/rrtmgp-data-lw-g256-2018-12-04.nc rrtmgp_cloud_optics_file_sw: ${SCREAM_DATA_DIR}/init/rrtmgp-cloud-optics-coeffs-sw.nc rrtmgp_cloud_optics_file_lw: ${SCREAM_DATA_DIR}/init/rrtmgp-cloud-optics-coeffs-lw.nc + pool_size_multiplier: 2.0 grids_manager: Type: Mesh Free