1. dalma-run_job_threads
  2. Dalma Manual
  3. dalma-run_job_threads

Running a Multithreading Job on Dalma

SYNOPSIS

You want to run a job with multi-threading (OpenMP, Pthreads and etc) application, but without multi-processing (e.g., MPI).

DESCRIPTION

To accomplish this, follow the steps:

1.- Specify the resouces required in Slurm directives in job script. Most importantly, --cpus-per-task for cpus per tasks. This should equal to the number of OpenMP threads (OMP_NUM_THREADS) to fully ultilized the allocated resources.

2.- Submit the job.

EXAMPLE

Job script for an OpenMP job with 28 threads, fully ultilizing 1 compute node. Save it using a meaningful filename. E.g., "openmp_job.sh"

#!/bin/bash 
## Set number of nodes to run
#SBATCH --nodes=1
# Set number of tasks to run
#SBATCH --ntasks=1
# Set number of cores per task (default is 1)
#SBATCH --cpus-per-task=28
# Walltime format hh:mm:ss
#SBATCH --time=00:30:00
# You may want to be exclusive on the compute node. 
# Remove the extra # below if needed
##SBATCH --exclusive
# Output and error files
#SBATCH -o job.%J.out
#SBATCH -e job.%J.err

# **** Actual commands start here ****
# Set number of OMP threads, directly from SLURM,
#   ultilizting all the cpus allocated.
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

# Load modules here (safety measure)
module purge

# You may need to load gcc here .. This is application specific
# module load gcc 

# Replace it with your actual command.
omp-hello

Submit the job, run this command in the terminal

sbatch openmp_job.sh

At this point, a job is submitted. A job ID will appears on the screen. Mark it down for future reference.

MORE ON SLURM DIRECTIVES

Normally, all lines begin with # is commented out in bash script. However, all SLURM directives start with #SBATCH. To comment out a SLURM directive, use ##SBATCH to begin the line. E.g.,

# The line below is effective
#SBATCH --nodes=1
# The line below is commented out, ineffective
##SBATCH --nodes=1
# The line below is also commented out, as it starts with # but not with #SBATCH
# SBATCH --nodes=1

Receive email notification

# This line specifies the email address.
# Change it to your actual email address.
#SBATCH --mail-user=first.last@nyu.edu
#
# This line specifies when you want to be alerted.
# If you set it to ALL, you will receive email notifications
# when the job starts, ends, aborts, resubmits.
# Another useful option is END. In this case you will only
# receive notification when the job ends.
#SBATCH --mail-type=ALL

Specify memory for the job

# This directive set the memory required by the job per node
# This example set the memory to 10GB per node
#SBATCH --mem=10G

AUTHORS

NYUAD HPC Apps Team:
--------------------
    - Benoit Marchand
    - Guowei He
    - Jorge Naranjo

SEE ALSO

Please refer to the online documentation available here

  1. NYUAD
  2. February 2017
  3. dalma-run_job_threads