Skip to content

Issue #1785 Add writing the HPC input file#1790

Open
verkaik wants to merge 1 commit intomasterfrom
issue_#1785_hpc_filein
Open

Issue #1785 Add writing the HPC input file#1790
verkaik wants to merge 1 commit intomasterfrom
issue_#1785_hpc_filein

Conversation

@verkaik
Copy link
Contributor

@verkaik verkaik commented Mar 18, 2026

Fixes #1785

Description

Support for writing the HPC input file as defined in the options block of the simulation name file. By enabling this option, the user can connect submodels to the MPI process ranks.

Checklist

  • Links to correct issue
  • Update changelog, if changes affect users
  • PR title starts with Issue #nr, e.g. Issue #737
  • Unit tests were added
  • If feature added: Added/extended example
  • If feature added: Added feature to API documentation
  • If pixi.lock was changed: Ran pixi run generate-sbom and committed changes

@verkaik verkaik requested a review from JoerivanEngelen March 18, 2026 14:36
@verkaik verkaik added the enhancement New feature or request label Mar 18, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Copy link
Contributor

@JoerivanEngelen JoerivanEngelen left a comment

Choose a reason for hiding this comment

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

Cool! Jinja templates and tests look good. I have some comments.

Furthermore: I'm not entirely sure about the API yet. For the UTL-ATS, we create a separate package (see: AdaptiveTimeStepping). I think we should do the same for UTL-HPC to keep things consistent, even though the UTL-HPC is such a trivial package to write.

This means a HighPerformanceComputing package, which has to be added to the simulation. The _write_hpc_package method can also be moved to this package. For user convenience, we can let the split method add this package to the generated simulation, so they don't have to worry less about not forgetting to add a HPC package themselves.

if mpi_rank < 0:
raise ValueError(f"Negative MPI rank of {mpi_rank} is not allowed.")
else:
mpi_rank = -1
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like sentinel values to indicate the mpi_rank is not set. It's more understandable for other developers to set mpi_rank to None here to indicate mpi_rank is not set.

class PartitionInfo(NamedTuple):
active_domain: GridDataArray
id: int
mpi_rank: int
Copy link
Contributor

Choose a reason for hiding this comment

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

See other comment on line R47 in this file

Suggested change
mpi_rank: int
mpi_rank: Optional[int]


for id, model_dict in self._partition_id_to_models.items():
mpi_rank = self.partition_info[id].mpi_rank
if mpi_rank > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

in the code in common.utilities.partitioninfo.py you assume -1 is an inactive mpi_rank, but here you assume mpi_rank==0 is inactive as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add HPC file support to simulation name file options for extended MODFLOW 6

2 participants