diff --git a/external/mom6_bathy b/external/mom6_bathy index a1bd00b..0bd5cae 160000 --- a/external/mom6_bathy +++ b/external/mom6_bathy @@ -1 +1 @@ -Subproject commit a1bd00bda3c161279906aa25d0ee44ddd7103bb7 +Subproject commit 0bd5cae2e2a0a680e03292b2e9e028826f59c4a0 diff --git a/tests/1_unit/test_cores_case_creator.py b/tests/1_unit/test_cores_case_creator.py index df3425e..8bbb71d 100644 --- a/tests/1_unit/test_cores_case_creator.py +++ b/tests/1_unit/test_cores_case_creator.py @@ -17,11 +17,11 @@ def test_calc_cores_based_on_grid_cases(): assert CaseCreator._calc_cores_based_on_grid(33) == 1 # Test ideal cores amount - assert CaseCreator._calc_cores_based_on_grid(800*128) == 128 + assert CaseCreator._calc_cores_based_on_grid(300*128) == 128 - assert CaseCreator._calc_cores_based_on_grid(800*32) == 128 + assert CaseCreator._calc_cores_based_on_grid(300*32) == 128 - assert CaseCreator._calc_cores_based_on_grid(740 * 780) == 768 + assert CaseCreator._calc_cores_based_on_grid(740 * 780) == 2048 \ No newline at end of file diff --git a/visualCaseGen/custom_widget_types/case_creator.py b/visualCaseGen/custom_widget_types/case_creator.py index 8205857..a9d8780 100644 --- a/visualCaseGen/custom_widget_types/case_creator.py +++ b/visualCaseGen/custom_widget_types/case_creator.py @@ -517,19 +517,21 @@ def _apply_all_xmlchanges(self, do_exec): xmlchange("NTASKS_OCN",cores, do_exec, self._is_non_local(), self._out) @staticmethod - def _calc_cores_based_on_grid( num_points, min_points_per_core = 32, max_points_per_core = 800, ideal_multiple_of_cores_used = 128): + def _calc_cores_based_on_grid( num_points, min_points_per_core = 32, max_points_per_core = 300, ideal_multiple_of_cores_used = 128): """Calculate the number of cores based on the grid size.""" min_cores = math.ceil(num_points/max_points_per_core) - max_cores = math.ceil(num_points/min_points_per_core) + max_cores = math.ceil(num_points/min_points_per_core) + + # If min_cores is less than the first multiple of ideal cores, just return the min_cores + if min_cores < ideal_multiple_of_cores_used: + return min_cores # Request a multiple of the entire core (ideal_multiple_of_cores_used) starting from the min ideal_cores = ((min_cores + ideal_multiple_of_cores_used - 1) // ideal_multiple_of_cores_used) * ideal_multiple_of_cores_used - if ideal_cores <= max_cores: - return ideal_cores - else: - return (max_cores+min_cores)//2 + return ideal_cores + def _apply_user_nl_changes(self, model, var_val_pairs, do_exec, comment=None, log_title=True): """Apply changes to a given user_nl file.""" @@ -586,7 +588,7 @@ def _apply_mom_namelist_changes(self, do_exec): # Determine timesteps based on the grid resolution (assuming coupling frequency of 1800.0 sec): res_x = float(cvars['OCN_LENX'].value) / int(cvars["OCN_NX"].value) res_y = float(cvars['OCN_LENY'].value) / int(cvars["OCN_NY"].value) - dt = 600.0 * min(res_x,res_y) # A 1-deg grid should have ~600 sec tstep (a safe value) + dt = 7200.0 * min(res_x,res_y) # A 1-deg grid should have ~600 sec tstep (a safe value) # Make sure 1800.0 is a multiple of dt and dt is a power of 2 and/or 3: dt = min((1800.0 / n for n in [2**i * 3**j for i in range(10) for j in range(6)] if 1800.0 % n == 0), key=lambda x: abs(dt - x)) # Try setting dt_therm to dt*4, or dt*3, or dt*3, depending on whether 1800.0 becomes a multiple of dt: