Message Passing Interface (MPI) is a standardized and portable message-passing system designed for parallel computing architectures. MPI is commonly used to develop parallel applications in High-Performance Computing (HPC) environments.
The POLARIS cluster supports OpenMPI and uses Slurm for job scheduling.
1. Load the OpenMPI Module
Before compiling or running MPI programs, load the OpenMPI module:
module avail module load mpi/openmpi-x86_64
Verify the module is loaded:
mpicc --version
2. Compile an MPI Program
Use mpicc (for C), mpicxx (for C++), or mpifort (for Fortran) to compile your MPI program.
Example (C program):
mpicc -o hello_mpi hello_mpi.c
3. Running MPI Jobs with Slurm (Recommended)
We recommend using srun within a Slurm job script rather than running mpirun directly on the login node.
Example Slurm Job Script (MPI)
#!/bin/bash #SBATCH --job-name=mpi_job #SBATCH --nodes=2 #SBATCH --ntasks-per-node=32 #SBATCH --time=02:00:00 #SBATCH --partition=cpucluster module load mpi/openmpi-x86_64 srun ./hello_mpi
Submit the job using:
sbatch your_job_script.sh
4. Running MPI Interactively (Optional)
If you need an interactive session:
salloc --nodes=1 --ntasks=8 --time=01:00:00 module load mpi/openmpi-x86_64 srun ./hello_mpi
5. Checking Job Status
To monitor your job:
squeue -u your_username
To view completed jobs:
sacct -u your_username
To cancel a job:
scancel jobID
Additional Resources
Comments
0 comments
Article is closed for comments.