|
|
# Running a task on the cluster
|
|
|
|
|
|
Jobs can be run on the cluster through the [srun](https://slurm.schedmd.com/srun.html) or [sbatch](https://slurm.schedmd.com/sbatch.html) commands. Both command supports common options, the main differences being that
|
|
|
* 'srun' is blocking, will print on the standard output and can run arbitrary commands, including sbatch scripts.
|
|
|
* `sbatch` will schedule the job for later execution and will only work with an executable sbatch script.
|
|
|
|
|
|
## sbatch script
|
|
|
|
|
|
An sbatch script must start with a [shebang line](https://en.wikipedia.org/wiki/Shebang_(Unix)):
|
|
|
```
|
|
|
$ head -1 ./run.slurm
|
|
|
#!/usr/bin/env bash
|
|
|
$
|
|
|
```
|
|
|
and be [executable](https://en.wikipedia.org/wiki/Modes_(Unix)):
|
|
|
```
|
|
|
$ ls -l ./run.slurm
|
|
|
-rw-r--r-- 1 alainm sit 180 Aug 14 10:09 ./run.slurm # WRONG
|
|
|
$ chmod a+x ./run.slurm
|
|
|
[alainm@pollux multithread]$ ls -l ./run.slurm
|
|
|
-rwxr-xr-x 1 alainm sit 180 Aug 14 10:09 ./run.slurm # GOOD
|
|
|
$
|
|
|
``` |