Skip to content

Commit 9406840

Browse files
committed
add intelmpi slurm container support
1 parent 70be24c commit 9406840

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/vsc/mympirun/mpi/intelmpi.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,25 @@ def mpirun_prepare_execution(self):
174174

175175
return super().mpirun_prepare_execution()
176176

177+
def prepare(self):
178+
super().prepare()
179+
180+
slurm_container = os.environ.get('SLURM_CONTAINER', None)
181+
if slurm_container is not None:
182+
logging.debug(f"Found SLURM_CONTAINER {slurm_container}")
183+
184+
# intel mpi has some support for running with singularity, but not for slurm container mode
185+
for key in [k for k in os.environ.keys() if k.startswith('APPTAINER') or k.startswith('SINGULARITY')]:
186+
logging(f"Removing environment variable {key} (value {os.environ[key]}) in slurm container mode")
187+
del os.environ[key]
188+
189+
if self._has_hydra() and self.HYDRA_RMK and self.HYDRA_RMK[0] == 'slurm':
190+
# need to pass full environment to tasks with slurm container wrapper
191+
if slurm_container.startswith('HPCWN'):
192+
slurm_container += ':fullenv'
193+
# pass the container option to srun in slurm bootstrap
194+
os.environ['I_MPI_HYDRA_BOOTSTRAP_EXEC_EXTRA_ARGS'] = f"--container {slurm_container}"
195+
177196
def pinning_override(self):
178197
""" pinning """
179198

0 commit comments

Comments
 (0)