... | ... | @@ -55,6 +55,8 @@ $ |
|
|
|
|
|
## Running in batch
|
|
|
|
|
|
### SLURM script
|
|
|
|
|
|
We need to write a slurm/sbatch script.
|
|
|
|
|
|
An sbatch script must start with a [shebang line](https://en.wikipedia.org/wiki/Shebang_(Unix)):
|
... | ... | @@ -72,3 +74,33 @@ $ chmod a+x ./run.slurm |
|
|
-rwxr-xr-x 1 alainm sit 180 Aug 14 10:09 ./run.slurm # GOOD
|
|
|
$
|
|
|
```
|
|
|
### Example
|
|
|
|
|
|
Compile the following [sequential.cpp](https://gitlab.oca.eu/DSI/HPC/blob/master/SLURM/sequential/sequential.cpp) source code:
|
|
|
```
|
|
|
$ icpc ./sequential.cpp -o sequential
|
|
|
$
|
|
|
```
|
|
|
We will submit it with the [sequential.slurm](https://gitlab.oca.eu/DSI/HPC/blob/master/SLURM/sequential/sequential.slurm) script.
|
|
|
```
|
|
|
$ sbatch ./sequential.slurm
|
|
|
Submitted batch job 15292921
|
|
|
$
|
|
|
```
|
|
|
wait for some time for the `rabit.<jobid>.out` to appear:
|
|
|
```
|
|
|
$ ls
|
|
|
rabit.15292921.out sequential sequential.cpp sequential.slurm
|
|
|
$ more rabit.15292921.out
|
|
|
This job was launch from pollux.cluster in /beegfs/SCRATCH/alainm/view/HPC/SLURM/sequential
|
|
|
What's up, Doc ?
|
|
|
$
|
|
|
```
|
|
|
### SBATCH directive
|
|
|
As we can see in the [sequential.slurm](https://gitlab.oca.eu/DSI/HPC/blob/master/SLURM/sequential/sequential.slurm) script, all the option we previously passed on the command line can be set once and for all in the script using the `#SBATCH <option>` directive. That is
|
|
|
> sbatch --job-name rabit ./sequential.slurm
|
|
|
is the same as adding
|
|
|
>#SBATCH --job-name=rabit
|
|
|
at the top of the script[^1]
|
|
|
|
|
|
[^1]: if both are used, the command line option takes precedence. |