Loading mpi4py

  • modulempi4py/latest
  • moduleanaconda/3
Tip: load modules inside your SLURM job script, not just on the login node, so compute nodes see the same environment. Verify with which after loading.

Example usage

Load the system mpi4py module

module load mpi4py/latest

Create a conda environment with mpi4py

module load anaconda/3
conda create --name my_parallel_env mpi4py numpy pandas
source activate my_parallel_env

Run an mpi4py script

mpirun -n $SLURM_NTASKS python my_script.py

Example Python script

from mpi4py import MPI comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size() print(f"Hello from process {rank} out of {size}!")

Availability

mpi4py is available on: SeaWulf, NVwulf, ClinWulf.