[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
slurm [2022/08/29 16:40]
vodrazka created
slurm [2022/09/02 14:56]
vodrazka [Batch mode]
Line 5: Line 5:
 ===== Basic usage ===== ===== Basic usage =====
  
 +==== Batch mode ====
  
 +The core idea is that you write a batch script containing the commands you wish to run as well as a list of ''SBATCH'' directives specifying the resources or parameters that you need for your job.
 +Then the script is submitted to the cluster with:
  
 +<code>sbatch myJobScript.sh</code>
 +
 +Here is a simple working example:
 +
 +<code>
 +#!/bin/bash
 +#SBATCH -J helloWorld   # name of job
 +#SBATCH -p cpu-troja   # name of partition or queue
 +#SBATCH -o helloWorld.out   # name of output file for this submission script
 +#SBATCH -e helloWorld.err   # name of error file for this submission script
 +
 +# run my job (some executable)
 +sleep 5
 +echo "Hello I am running on cluster!"
 +</code>
 +
 +After submitting this simple code you should end up with the two files (''helloWorld.out'' and ''helloWorld.err'') in the directory where you called the ''sbatch'' command.
 +
 +Here is the list of other useful ''SBATCH'' directives:
 +<code>
 +#SBATCH -D /some/path/                        # change directory before executing the job   
 +#SBATCH -N 2                                  # number of nodes (default 1)
 +#SBATCH --nodelist=node1,node2...             # required node, or comma separated list of required nodes
 +#SBATCH -c 4                                  # number of cores/threads per task (default 1)
 +#SBATCH --gres=gpu:                         # number of GPUs to request (default 0)
 +#SBATCH --mem=10G                             # request 10 gigabytes memory (per node, default depends on node)
 +</code>
 +
 +==== Interactive mode ====
 +
 +This mode can be useful for testing You should be using batch mode for any serious computation.
 +You can use **''srun''** command to get an interactive shell on an arbitrary node from the default partition (queue):
 +
 +<code>srun --pty bash</code>
 +
 +There are many more parameters available to use. For example:
 +
 +<code>srun -p cpu-troja --mem=64G --pty bash</code>
 +
 +Where:
 +  * ''-p cpu-troja'' explicitly requires partition ''cpu-troja''
 +  * ''--mem=64G'' requires 64G of memory for the job
 +
 +To see all the available options type:
 +
 +<code>man srun</code>
  

[ Back to the navigation ] [ Back to the content ]