Table of Contents
CLUSTER MANUAL
Bash files and Batch system
What's on this page:
- Dos and don'ts
- Batch System
- Creating a job script
- How to pass command-line parameters to the job script
1. Dos and don'ts
- Never run calculations on the home disk
- Always use the SLURM queueing system
- The login via the GUI is only for editing files, submitting jobs and visual inspections
- Do not run calculations interactively via the GUI
- Never use spaces for file names, folder names or job process names.
2. Batch System
The Psychp01 cluster is a resource that is shared between many of users and to ensure fair use everyone must do their computations by submitting jobs through a batch system that will execute the applications on the available resources.
The batch system on Psychp01 is SLURM (Simple Linux Utility for Resource Management).
3. Creating a job script
To run a job on the batch system you need to create a job script. A job script is a regular shell script (bash) with some directives specifying the number of CPUs, memory, etc., that will be interpreted by the batch system upon submission.
After you wrote your job script as shown in the examples, you can start it with:
sbatch my_job_script_name.sh
You can find job script examples in the Running jobs section. On page 23 of the pdf version of the manual on the main page, there is a short video on how to run a Python code using a job script. See here for a step-by-step explanation.
4. How to pass command-line parameters to the job script
It is sometimes convenient if you do not have to edit the job script every time you want to change the input file. Or perhaps you want to submit hundreds of jobs and loop over a range of input files. For this it is handy to pass command-line parameters to the job script. For how to use different parameters and to find a link to a list of possible parameters, see SLURM Parameters in the Running jobs section.
In SLURM you can do this:
$ sbatch myscript.sh myinput myoutput
And then you can pick the parameters up inside the job script:
#!/bin/bash #SBATCH ... #SBATCH ... ... # argument 1 is myinput # argument 2 is myoutput mybinary.x < ${1} > ${2}
For recommended sets of parameters see also sections Advanced SLURM and Running jobs.
Discussion