Tutorials

Logging In

Logging in uses Princeton LDAP authentication. Please log in using "ssh". You may be prompted for a password. If that is the case, please enter your LDAP password.

Compiling parallel MPI programs

By default, the Intel compilers will be used for all Fortran and C code:

module load openmpi
mpif77 myMPIcode.f
mpif90 myMPIcode.f
mpicc myMPIcode.c
 

Submitting a Parallel Processing Job

Once the parallel processing executable, a.out, is compiled, a job script will need to be created for Slurm. Here is a sample command script, parallel.cmd, which uses 16 CPUs (8 CPU cores per node).
MPI job:
 
#!/bin/bash
# parallel job using 16 processors. and runs for 4 hours (max)
#SBATCH -N 2 # node count
#SBATCH --ntasks-per-node=8
#SBATCH -t 4:00:00

# sends mail when process begins, and
# when it ends. Make sure you define your email
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
#SBATCH --mail-user=yourNetID@princeton.edu

# Load openmpi environment
module load openmpi

srun ./a.out

 

To submit the job to the batch system, use:
 
sbatch parallel.cmd

Submitting a Single Serial Job

Once the serial processing executable, a.out, is compiled, a job script will need to be created for Slurm. Here is a sample command script, serial.cmd, which uses (of course) 1 CPU.
Serial job:
 
#!/bin/bash
# serial job using 1 node and 1 processor,
# and runs for 4 hours (max).
#SBATCH -N 1 # node count
#SBATCH --ntasks-per-node=1
#SBATCH -t 4:00:00
# sends mail when process begins, and
# when it ends. Make sure you define your email
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
#SBATCH --mail-user= yourNetID@princeton.edu
cd /home/bill/my_serial_directory
./a.out
 
To submit the job to the batch system, use:
 
sbatch serial.cmd

Submitting Multiple Serial Tasks with a Single Job

NOTE: Do not use this method if the multiple serial tasks running as part of a single job are expected to have significantly different execution times. This will result in tying up idle processors.
Once the serial executable, a.out, is compiled, a job script will need to be created for Slurm. Here is a sample command script, mixed.cmd, which schedules multiple instances of a serial task.
multiple serial job:
 
#! /bin/bash
#
#SBATCH -N 1 # node count
#SBATCH --ntasks-per-node=10
#SBATCH -t 4:00:00
# sends mail when process begins, and
# when it ends. Make sure you define your email
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
#SBATCH --mail-user= yourNetID@princeton.edu


# Run instance of the serial job with unique parameters

for ((myproc=1; myproc<=$SLURM_NPROCS; myproc++)) do
./a.out $myproc > test-$myproc.out &
done
wait

To submit the job to the batch system, use:
sbatch mixed.cmd
Command Synopsis
sinfo Shows how nodes are being used.
sshare/sprio Shows the priority assigned to queued jobs.
squeue or qstat Shows jobs in the queues.
smap/sview A graphical display of the queues.
slurmtop A text based view of the cluster nodes