Skip to content

Commit

Permalink
Some of the unit tests use a ton of memory, so add a pool multiplier …
Browse files Browse the repository at this point in the history
…option
  • Loading branch information
jgfouca committed Feb 5, 2025
1 parent d9fcc1a commit 25b266e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions components/eamxx/cime_config/namelist_defaults_scream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ be lost if SCREAM_HACK_XML is not enabled.
<do_subcol_sampling type="logical" doc="Flag to turn on/off subcolumn sampling of optical properties; if false treat cells as either completely clear or cloudy">
true
</do_subcol_sampling>
<pool_size_multiplier type="real">1.0</pool_size_multiplier>
</rrtmgp>

<mac_aero_mic inherit="atm_proc_group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ void RRTMGPRadiation::initialize_impl(const RunType /* run_type */) {
m_n2vmr = m_params.get<double>("n2vmr", 0.7906);
m_covmr = m_params.get<double>("covmr", 1.0e-7);

const double multiplier = m_params.get<double>("pool_size_multiplier", 1.0);

// Whether or not to do MCICA subcolumn sampling
m_do_subcol_sampling = m_params.get<bool>("do_subcol_sampling",true);

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<spdlog::logger>& logger)
const std::shared_ptr<spdlog::logger>& logger,
const double multiplier = 1.0)
{
// If we've already initialized, just exit
if (initialized_k) {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/eamxx/src/physics/rrtmgp/tests/rrtmgp_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25b266e

Please sign in to comment.