Difference between revisions of "Quickstart/sbatch"
(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...") |
m |
||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
== Introduction == | == 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 | + | 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 an HPC system like Viper is by submitting jobs to run automatically without interaction when the 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: | + | 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, and 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. | + | * A set of directives that provides Slurm with 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. | * 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. | * The actual command(s) that need to be run. |
Latest revision as of 14:24, 9 November 2022
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 an HPC system like Viper is by submitting jobs to run automatically without interaction when the 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, and sets up the environment so the task can run. A minimal submission script has three main components:
- A set of directives that provides Slurm with 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