Skip to content

Remove hardcoded cpus_per_task=128 in landice mesh_gen cases#957

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/update-cpus-per-task-setting
Draft

Remove hardcoded cpus_per_task=128 in landice mesh_gen cases#957
Copilot wants to merge 6 commits intomainfrom
copilot/update-cpus-per-task-setting

Conversation

Copy link
Copy Markdown

Copilot AI commented May 5, 2026

  • Identify duplicated from compass.landice.mesh import (...) patterns in landice mesh step files
  • Attempt baseline lint/smoke checks (pre-commit, compass CLI); environment missing required tools/dependencies
  • Replace repeated symbol-list imports with a single module import alias in affected files
  • Update references (LandiceMeshStep and mesh utility function calls) to use the module alias
  • Run available validation checks after edits
  • Summarize changes and any validation limitations

Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
Override constrain_resources in all 7 landice mesh step classes to
set cpus_per_task to all available cores rather than hardcoding 128.
This allows region mask creation and culling operations to use all
allocated processors, which is especially beneficial for large meshes
(Antarctica, Greenland) that require many nodes.
Copilot AI changed the title [WIP] Update cpus_per_task to use all available processors Remove hardcoded cpus_per_task=128 in landice mesh_gen cases May 5, 2026
Copilot finished work on behalf of trhille May 5, 2026 16:33
Copilot AI requested a review from trhille May 5, 2026 16:33
Copy link
Copy Markdown
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces a lot of repeated code. Let's move constrain_resources() to compass/landice/mesh.py and import it for use in each mesh_gen case.
Also, we might still need to set min_cpus_per_task=1 (or possibly the min of 128 and available_resources['cores']?)

Consolidate the repeated constrain_resources logic into a shared
module-level function in compass/landice/mesh.py that calls
Step.constrain_resources then sets cpus_per_task to all available
cores. All 7 mesh_gen step files now import and delegate to this
shared function instead of duplicating the logic.
Copy link
Copy Markdown
Author

Copilot AI commented May 5, 2026

This produces a lot of repeated code. Let's move constrain_resources() to compass/landice/mesh.py and import it for use in each mesh_gen case.
Also, we might still need to set min_cpus_per_task=1 ...

Done. The constrain_resources function is now in compass/landice/mesh.py — it calls Step.constrain_resources (via a local import to avoid circular imports) then sets self.cpus_per_task = available_resources['cores']. Each of the 7 step files imports and delegates to it in a one-liner override. The min_cpus_per_task defaults to 1 (the Step.__init__ default), which is correct here since we want to accept any number of available cores.

Copilot finished work on behalf of trhille May 5, 2026 16:41
Copilot AI requested a review from trhille May 5, 2026 16:41
Comment thread compass/landice/tests/antarctica/mesh.py Outdated
Copilot finished work on behalf of trhille May 5, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cpus_per_task hardcoded in landice mesh_gen cases

2 participants