Skip to main content »

Trinity College Dublin

Running Fewer MPI Tasks Than Available Cores

In some edge cases a user may want to only run 1 MPI tasks on a node which contains 8 cores.

Example 1 - use a single core per node:

To do this change your script to the following:

#!/bin/sh
#SBATCH -N 4            # ask for 4 nodes
#SBATCH -n 4            # ask for 4 cores in total (in this case it is ONE core per node)
#SBATCH -t 1-03:00:00   # 1 day and 3 hours
#SBATCH -p compute      # partition name
#SBATCH -U chemistry    # your project name - contact Ops if unsure what this is
#SBATCH -J my_job_name  # sensible name for the job

mpirun ./cpi.x

The above assumes that openmpi is being used and will ask for 4 nodes but launch 1 process per node.

Example 2 - use several cores per node:

This might be very useful if you need to use more RAM per core. Example is as follows:

#!/bin/sh
#SBATCH -N 8            # ask for 8 nodes
#SBATCH -n 16           # ask for 16 cores in total (in this case it is TWO cores per node)
#SBATCH -t 1-03:00:00   # 1 day and 3 hours
#SBATCH -p compute      # partition name
#SBATCH -U chemistry    # your project name - contact Ops if unsure what this is
#SBATCH -J my_job_name  # sensible name for the job

mpirun ./cpi.x

This gives you 8 nodes and runs 2 mpi process on each node (i.e. 16 mpi processes in total). If you ask half of the cores available on the node they are going to share all the available RAM between themselves, so each core will have effectively double the amount of RAM.


Last updated 10 Feb 2015Contact TCHPC: info | support.