You are located in service: RWTH High Performance Computing (Linux)

Example Slurm Job

Example Slurm Job

Kurzinformation

Here you will find a basic example job script for the Slurm batch system and further links for using the system.


Detailinformation

Batch scripts are files that contain the definition of required hardware resources (see #SBATCH lines) and the code you wish to run on an HPC compute node.

These batch scripts are submitted to Slurm using a unix console with the command sbatch. Using the console is required to submit batch scripts using sbatch.

Take the following code and save it to a file on your home directory in the cluster, using a file editor.

Basic example Slurm job script file

#!/usr/bin/zsh

### Start of Slurm SBATCH definitions
# Ask for eight tasks (same as 8 cores for this example)
#SBATCH --ntasks=8

# Ask for the maximum memory per core (most CLAIX-2023 nodes: 2.7GB per cpu) 
#SBATCH --mem-per-cpu=2500M

# Ask for up to 15 Minutes of runtime
#SBATCH --time=00:15:00

# Name the job
#SBATCH --job-name=EXAMPLE_JOB

# Declare a file where the STDOUT/STDERR outputs will be written
#SBATCH --output=output.%J.txt

### end of Slurm SBATCH definitions


### your program goes here (hostname is an example, can be any program)
# `srun` runs `ntasks` instances of your programm `hostname`

srun hostname

After saving this example to a file ~/example.sh you can run the Slurm job by submitting it to Slurm using sbatch :

sbatch ~/example.sh

The previous example uses the zsh shell, which is the only officially supported shell at the RWTH HPC Claix Cluster.


​ Zusatzinformation

Basic Slurm doumentation on hpc-wiki.info:

 

last changed on 02/23/2024

How did this content help you?

Creative Commons Lizenzvertrag
This work is licensed under a Creative Commons Attribution - Share Alike 3.0 Germany License