-

This site is deprecated and will be decommissioned shortly. For current information regarding HPC visit our new site: hpc.njit.edu

SLURMIntro

From NJIT-ARCS HPC Wiki
Jump to: navigation, search

Batch job submission

Batch jobs involve submitting a file to SLURM that contains your resource requirements and the program you want to run.

  1. Create a script containing:
    • Instructions and requirements for the SLURM scheduler using the #SBATCH directives
    • Loading of required modules with
      module load <moudule1> <module2> ...
  2. Call your script/software/code with the sbatch command
    sbatch [script_file]

For testing purposes, use the debug partition (queue) (#SBATCH -p debug).

Which partitions (formerly known as "queues") can I run on?

To see the partitions on which you are enabled, enter
allowed.partitions

Batch job example

Create an R script, Rtest.R:

library("ggplot2")
qplot(depth, ..density.., data = diamonds, geom = "freqpoly",  xlim = c(58, 68), binwidth = 0.1, colour = cut)

This will use ggplot to plot the Diamonds sample data set that is part of the ggplot2 distribution

Create the batch script that you will submit with the sbatch command

NOTE: Make sure there are no blank lines in your sbatch script before any #SBATCH directives, or the following #SBATCH directives will be ignored!

Create an sbatch script, Rtest.sbatch:

#!/bin/bash -l
#
# All lines that start with "#SBATCH" contain commands that are used by SLURM for scheduling
#################
# Set a job name  
#SBATCH --job-name=Rtest
#################  
# Set the file for job output. You can check job progress via this file. Use "%j" to include the job ID in the file name.
#SBATCH --output=Rtest.%j.out
#################
# Set the file for error output from the job
#SBATCH --error=Rtest.%j.err
#################
# Set the run time you think you need
# Time format options: dd-hh:mm:ss or hh:mm:ss or mm:ss or mm
#SBATCH --time=5:00
#################
# Set the Quality of Service (QoS) [More on this later]
#SBATCH --qos=[some name]
# Submit job to the medium partition
#SBATCH -p medium
#################
# Set memory per node. You can use M(MB), G(GB), T(TB)
#SBATCH --mem=4G
# --mem-per-cpu, amount of memory per allocated CPU, can also be used. Use --mem <strong>OR</strong> --mem-per-cpu
#################
# Have SLURM send you mail when the job ends or fails
#SBATCH --mail-type=end,fail 
#SBATCH --mail-user=ucid@njit.edu
#################
# Note that "CMD BATCH" is an R-specific command
module load R
R CMD BATCH ./Rtest.R

Submit Rtest.sbatch:

sbatch Rtest.sbatch