Skip to content

Running Slurm Batch Jobs

Batch jobs are the primary way one would use Picotte.

Overview

  • Have an application ready to run
  • Write a batch script which requests appropriate resources
  • Submit the batch script

Application to Run

This is a non-interactive computation that you intend to run. For instance, it could be a Python script:

#!/usr/bin/env python
###
### this file is named process_data.py
###
import mystuff

mystuff.do_the_computation("/ifs/opt/myGrp/data/input_data.dat")

Make the script executable by doing:

[juser@picotte001 ~]$ chmod +x process_data.py

Or an actual application such as LAMMPS, etc.

Write the Batch Script

The batch script is a Bash shell script, with directives specifying the resources needed for the job. It should also set up the environment needed to run the computation, e.g. loading appropriate modules, setting environment variables, etc.

Say this file is named "process_data.sh".

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=16G
#SBATCH --account=somethingPrj
#SBATCH --time=12:00:00

module load python/gcc/3.9.1

./process_data.py

Please see the Slurm Glossary for details about what these terms mean.

Submit the Batch Script

Submit the batch script to the job scheduler, which will decide if there are enough resources available to run the job:

[juser@picotte001 ~]$ sbatch process_data.sh

IMPORTANT sbatch does not launch tasks. It requests an allocation of resources specified in the batch script. Slurm examines the state of all nodes to determine if those resources are available, and if so, sends the job script to the set of nodes that have available resources.

Examine Outputs

By default, any output printed to stdout and stderr will go to a file named "slurm-jobid.out".

See Also