-
Notifications
You must be signed in to change notification settings - Fork 42
Reduce required procs for some landice tests #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
trhille
merged 5 commits into
MPAS-Dev:main
from
matthewhoffman:landice/nproc-reduction
Mar 30, 2026
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a692070
Make Humboldt tests resource-aware
matthewhoffman 8cb5e3e
Make greenland & thwaites decomp tests resource-aware
matthewhoffman 18f4dec
Update docs
matthewhoffman 3947f92
Fix proc checks to ignore login node info
matthewhoffman 0e1aea1
Fixup single_node logic
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,26 @@ | ||
| from compass.validate import compare_variables | ||
| from compass.testcase import TestCase | ||
| from compass.landice.tests.greenland.run_model import RunModel | ||
| from compass.parallel import get_available_parallel_resources | ||
| from compass.testcase import TestCase | ||
| from compass.validate import compare_variables | ||
|
|
||
|
|
||
| class DecompositionTest(TestCase): | ||
| """ | ||
| A test case for performing two MALI runs of the Greenland Ice Sheet setup, | ||
| one with one core and one with eight. The test case verifies that the | ||
| results of the two runs are identical. | ||
| A test case for performing two MALI runs of the Greenland Ice Sheet setup | ||
| with different decompositions. The larger decomposition targets up to 32 | ||
| tasks, subject to available resources, and the smaller decomposition is | ||
| roughly half of the larger one. | ||
|
|
||
| Attributes | ||
| ---------- | ||
| velo_solver : str | ||
| The velocity solver used for the test case | ||
|
|
||
| proc_list : list of int | ||
| The pair of processor counts used in the decomposition comparison | ||
|
|
||
| run_dirs : list of str | ||
| The names of the subdirectories for the two decomposition runs | ||
| """ | ||
|
|
||
| def __init__(self, test_group, velo_solver): | ||
|
|
@@ -24,34 +37,55 @@ def __init__(self, test_group, velo_solver): | |
| """ | ||
| name = 'decomposition_test' | ||
| self.velo_solver = velo_solver | ||
| self.proc_list = None | ||
| self.run_dirs = None | ||
| subdir = '{}_{}'.format(velo_solver.lower(), name) | ||
| super().__init__(test_group=test_group, name=name, subdir=subdir) | ||
|
|
||
| if velo_solver == 'sia': | ||
| self.cores_set = [1, 8] | ||
| elif velo_solver == 'FO': | ||
| self.cores_set = [16, 32] | ||
| def configure(self): | ||
| """ | ||
| Choose decomposition sizes from framework-detected resources and add | ||
| run steps. | ||
|
|
||
| The larger decomposition targets up to 32 tasks. FO runs require at | ||
| least 10 tasks; SIA runs require at least 2 tasks. | ||
| """ | ||
| available_resources = get_available_parallel_resources(self.config) | ||
| target_max_tasks = 32 | ||
| if self.velo_solver == 'FO': | ||
| smallest_acceptable_max_tasks = 10 | ||
| elif self.velo_solver == 'sia': | ||
| smallest_acceptable_max_tasks = 2 | ||
| else: | ||
| raise ValueError('Unexpected velo_solver {}'.format(velo_solver)) | ||
| raise ValueError(f'Unexpected velo_solver {self.velo_solver}') | ||
|
|
||
| max_tasks = max( | ||
| smallest_acceptable_max_tasks, | ||
| min(target_max_tasks, available_resources['cores'])) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this must be the culprit line. |
||
| low_tasks = max(1, max_tasks // 2) | ||
| self.proc_list = [low_tasks, max_tasks] | ||
|
|
||
| for procs in self.cores_set: | ||
| self.run_dirs = [] | ||
| for procs in self.proc_list: | ||
| name = '{}proc_run'.format(procs) | ||
| if name in self.run_dirs: | ||
| name = '{}_{}'.format(name, len(self.run_dirs) + 1) | ||
| self.run_dirs.append(name) | ||
| self.add_step( | ||
| RunModel(test_case=self, velo_solver=velo_solver, name=name, | ||
| RunModel(test_case=self, velo_solver=self.velo_solver, | ||
| name=name, | ||
| subdir=name, ntasks=procs, min_tasks=procs, | ||
| openmp_threads=1)) | ||
|
|
||
| # no configure() method is needed | ||
|
|
||
| # no run() method is needed | ||
|
|
||
| def validate(self): | ||
| """ | ||
| Test cases can override this method to perform validation of variables | ||
| and timers | ||
| """ | ||
| name1 = '{}proc_run'.format(self.cores_set[0]) | ||
| name2 = '{}proc_run'.format(self.cores_set[1]) | ||
| name1 = self.run_dirs[0] | ||
| name2 = self.run_dirs[1] | ||
| if self.velo_solver == 'sia': | ||
| compare_variables(test_case=self, | ||
| variables=['thickness', 'normalVelocity'], | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in my comment, this doesn't seem to be happening for any of the tests.