Skip to content

Commit

Permalink
Add utility error when using MPI with non-MPI partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Jun 2, 2024
1 parent be9612c commit 43bd5ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rustcoalescence/src/cli/simulate/parse/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ pub(in super::super) fn parse_and_normalise(

normalised_args.partitioning(&partitioning);

#[cfg(feature = "mpi-partitioning")]
if !matches!(&partitioning, Partitioning::Mpi(_)) {
match necsim_partitioning_mpi::MpiPartitioning::initialise() {
Ok(_) | Err(necsim_partitioning_mpi::MpiPartitioningError::AlreadyInitialised) => {
anyhow::bail!("MPI should not be used together with a non-MPI partitioning")
},
Err(necsim_partitioning_mpi::MpiPartitioningError::NoParallelism) => (),
}
}

Ok(partitioning)
}

Expand Down

0 comments on commit 43bd5ca

Please sign in to comment.