Skip to content

Instantly share code, notes, and snippets.

@sjdonado
Last active April 9, 2021 16:54
Show Gist options
  • Save sjdonado/6608a1cec3fea28b8503de401c180ebd to your computer and use it in GitHub Desktop.
Save sjdonado/6608a1cec3fea28b8503de401c180ebd to your computer and use it in GitHub Desktop.
Setup and run mi4py Uninorte HPC

Setup conda env

  • Load nested modules
module purge
module load miniconda gnu8/8.3.0 openmpi3/3.1.4
  • Create conda env
conda create --name mpi4py python=3.7 -y
eval "$(conda shell.bash hook)"
conda activate mpi4py
  • Install python libs
export MPICC=$(which mpicc)
pip install numpy matplotlib seaborn scipy netCDF4 pandas mpi4py

Run interactive session

salloc --job-name "mpi4py-test" --nodes 1 --ntasks 4 --cpus-per-task=1 -t 24:00:00 -A syseng -p syseng

module purge
module load miniconda gnu8/8.3.0 openmpi3/3.1.4

eval "$(conda shell.bash hook)"
conda activate mpi4py

mpiexec -n 4 python test_CPU.py 2> err.log

Run SBATCH

#!/bin/bash
#SBATCH --job-name=mpi4py-test   # create a name for your job
#SBATCH --nodes=1                # node count
#SBATCH --ntasks=8               # total number of tasks
#SBATCH --cpus-per-task=1        # cpu-cores per task
#SBATCH --time=24:00:00          # total run time limit (HH:MM:SS)
#SBATCH --account=syseng
#SBATCH --partition=syseng

module purge
module load miniconda gnu8/8.3.0 openmpi3/3.1.4

eval "$(conda shell.bash hook)"
conda activate mpi4py

srun python hello_mpi.py

More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment