Skip to content

fix process binding for mpirun with OpenMPI - #305

Merged
satishskamath merged 10 commits into
EESSI:mainfrom
smoors:prte
Feb 12, 2026
Merged

satishskamath merged 10 commits into
EESSI:mainfrom
smoors:prte

Conversation

@smoors

@smoors smoors commented Nov 29, 2025 •

Copy link
Copy Markdown
Collaborator

fixes #297

this uses the mpirun cmd line options for OpenMPI instead of the environment variables.

a number of fixes have been added to OpenMPI recently, which should allow using environment variables for new (soon to be released) versions, but we still need to support older versions as well

open-mpi/ompi#13601
open-mpi/ompi#13586

@smoors
smoors marked this pull request as draft November 29, 2025 21:01
Samuel Moors added 3 commits November 29, 2025 22:05
@satishskamath

satishskamath commented Dec 22, 2025 •

Copy link
Copy Markdown
Collaborator

open-mpi/ompi#13586 (comment)

This option of specifying PEs per slot was removed for the default mapping policy within OMPIv5. This is now being added back and will be merged in further OMPI updates but not the existing versions. I have asked for an equivalent environment variable for the command line option --map-by because we can definitely do it there.

@casparvl

casparvl commented Dec 23, 2025 •

Copy link
Copy Markdown
Collaborator

So... one option I see is to query the launcher and inject the right --map-by arguments (if the launcher is mpirun). The downside is: it needs to be OpenMPI's mpirun, and I'm not sure how EESSI it is to determine that (at least I dont think Intel's mpirun would know this argument?)

@smoors

smoors commented Dec 29, 2025 •

Copy link
Copy Markdown
Collaborator Author

apparently intel mpirun happily ignores --map-by (but not --report-bindings), so it's doable

$ mpirun --map-by slot:PE=2 -genv I_MPI_DEBUG=4 hostname                                                                                                                                                             
Options -binding/-bind-to/-map-by/-membind are not supported and will be ignored.
        Please refer I_MPI_PIN environment variables family.
node800.hydra.os
node800.hydra.os
node800.hydra.os
node800.hydra.os

EDIT: this only works for 2025a, it fails in 2024a

@smoors

smoors commented Dec 31, 2025

Copy link
Copy Markdown
Collaborator Author

So... one option I see is to query the launcher and inject the right --map-by arguments (if the launcher is mpirun). The downside is: it needs to be OpenMPI's mpirun, and I'm not sure how EESSI it is to determine that (at least I dont think Intel's mpirun would know this argument?)

another solution (and probably easier) is to patch the current OpenMPI v5 easyconfigs with the changes posted by Ralph so we can continue using the envvars.

@smoors smoors mentioned this pull request Jan 3, 2026
@casparvl

casparvl commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

another solution (and probably easier) is to patch the current OpenMPI v5 easyconfigs with the changes posted by Ralph so we can continue using the envvars.

That's not a bad idea, assuming the patch applies as a stand-alone thing on the OpenMPI v5 versions we have in EESSI. The only (minor) downside is that for people running the test-suite on a local software stack, this won't "help". But seeing as this is a transient problem anyway, I'd favor this solution above coming up with something that complicates the test-suite code unnecessarily (and that we then have to maintain / deprecate / take out once the time comes).

So: thumbs-up from my side for this idea :)

@satishskamath

Copy link
Copy Markdown
Collaborator

As long as the patch does not affect the existing code in any other manner and also because this is a transient issue (only affects certain versions of OMPI), I am also in favour of patching it at the EB level. But the patch should include only parts that activate these env variables, I think Ralph is the only one who can provide it in a clean manner. We can try and request it. May be good to open an issue in EB repo as well.

@smoors

smoors commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator Author

ok, i found that it's actually not that complicated to detect it's OpenMPI's mpirun, see 4f860af

as @casparvl noted, the advantage is that this will also work for local stacks without the need to reinstall anything with a patch.

@smoors smoors changed the title add PRTE_MCA_rmaps_base_mapping_policy fix process binding for mpirun with OpenMPI Jan 5, 2026
@smoors
smoors marked this pull request as ready for review January 5, 2026 17:53
Comment thread eessi/testsuite/hooks.py
pattern = "|".join(ompi_patterns)
if any(re.search(pattern, x) for x in test.modules):
test.job.launcher.options.append(f'--map-by slot:PE={physical_cpus_per_task} --report-bindings')
log(f'Set launcher command to {test.job.launcher.run_command(test.job)}')

@smoors smoors Jan 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

note that the run command logged here is not correct yet, but that will be fixed once #312 is merged

@casparvl casparvl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We opted to go for the command line option instead of the env var, instead of backporting the patch to older OpenMPI V5.X versions.

  • Upside is that this also works if sites dont rebuild their OpenMPI V5 installations with the patch.
  • Downside is that this requires us to maintain a bit more logic, for OpenMPI versions that will eventually be obsolete.

We consider the upside bigger than the downside, so proceed with this approach.

@satishskamath

Copy link
Copy Markdown
Collaborator
#!/bin/bash
#SBATCH --job-name="rfm_EESSI_OSU_pt2pt_CPU_59f4b331"
#SBATCH --ntasks=2
#SBATCH --ntasks-per-node=2
#SBATCH --cpus-per-task=64
#SBATCH --output=rfm_job.out
#SBATCH --error=rfm_job.err
#SBATCH --time=0:30:0
#SBATCH -p rome
#SBATCH --export=None
#SBATCH --mem=218749M
module load EESSI/2025.06
module load OSU-Micro-Benchmarks/7.5-gompi-2025a
export OMP_NUM_THREADS=64
export I_MPI_PIN_CELL=core
export I_MPI_PIN_DOMAIN=64:compact
export I_MPI_DEBUG=4
mpirun -np 2 --map-by slot:PE=64 --report-bindings osu_bw -m 4194304 -x 5 -i 10 -c
echo "EESSI_CVMFS_REPO: $EESSI_CVMFS_REPO"
echo "EESSI_SOFTWARE_SUBDIR: $EESSI_SOFTWARE_SUBDIR"
echo "FULL_MODULEPATH: $(module --location show OSU-Micro-Benchmarks/7.5-gompi-2025a 2>&1)"

This is the batch file that is generated and it runs fine. The only problem here is within the OSU test where the number of threads need to be explicitly set to 1.

@satishskamath satishskamath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm!

@satishskamath
satishskamath merged commit 2c3204b into EESSI:main Feb 12, 2026
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.

Update OMPI_MCA environment variables used to their PRTE_MCA_ equivalents

3 participants