Quickstart/sbatch

From HPC
Revision as of 14:22, 9 November 2022 by Chris.collins (talk | contribs) (Created page with "__TOC__ == Introduction == Having been introduced to the Slurm scheduler in Quickstart/Slurm and then one of the ways of using Viper with Interactive sessions in Quickst...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation , search

Introduction

Having been introduced to the Slurm scheduler in Quickstart/Slurm and then one of the ways of using Viper with Interactive sessions in Quickstart/Interactive the next way of making use of a HPC system like Viper is by submitting jobs to run automatically without interaction when resource becomes available. We call these batch jobs.

In order to run a batch job, we need to provide Slurm with information about what we want to do. We do this via a job submission script, which is sort of like a recipe for the job. The submission script is a text file that provides information to Slurm about the task you are running so that it can be allocated to the appropriate resource, sets up the environment so the task can run. A minimal submission script has three main components:

  • A set of directives that provides Slurm some high level information such as what resource is required, a job name, how long the task should run for and where to log any output that would normally be shown on the screen.
  • Information about how the job environment should be set up, for example, what application Quickstart/Modules should be loaded.
  • The actual command(s) that need to be run.


#!/bin/bash
#SBATCH -J
#SBATCH -n 1
#SBATCH -o slurm-%j.log
#SBATCH -e slurm-%j.err
#SBATCH -p compute
#SBATCH --time=0-01:00:00

module purge
module add MODULENAME

command

Simple Example Job Submissions Scripts

Matlab

#!/bin/bash
#SBATCH -J myjob
#SBATCH -n 1
#SBATCH -o slurm-%j.out
#SBATCH -e slurm-%j.out
#SBATCH -p compute
#SBATCH --time=0-01:00:00
 
module purge
module add MODULENAME
 
COMMAND SCRIPT

R

#!/bin/bash
#SBATCH -J myjob
#SBATCH -n 1
#SBATCH -o slurm-%j.out
#SBATCH -e slurm-%j.out
#SBATCH -p compute
#SBATCH --time=0-01:00:00
 
module purge
module add MODULENAME
 
COMMAND SCRIPT