User Tools

Site Tools


submission_script

This is an old revision of the document!


A submission file script contains all the information required by SLURM in order to launch your job. We will detail a very simple script that launch “hostname” on two hosts :

nicolas.greneche@magi1:~$ cat hostname.slurm
#!/bin/bash
#SBATCH --job-name=hostname
#SBATCH --output=slurm.out
#SBATCH --error=slurm.err
#SBATCH --mail-type=end
#SBATCH --mail-user=nicolas.greneche@univ-paris13.fr
#SBATCH --nodes=2
srun hostname

We submit this script with “sbatch” command :

nicolas.greneche@magi1:~$ sbatch hostname.slurm
Submitted batch job 44066

And we check the output :

nicolas.greneche@magi1:~$ cat slurm.out
magi66
magi75

nicolas.greneche@magi1:~$ cat run.slurm #!/bin/bash #SBATCH –job-name=OMP_hello #SBATCH –output=slurm.out #SBATCH –error=slurm.err #SBATCH –partition=COMPUTE-SHORT #SBATCH –nodes=1 #SBATCH –ntasks-per-node=1 #SBATCH –cpus-per-task=4

export OMP_NUM_THREADS=4 srun -l hello_openmp

nicolas.greneche@magi1:~$ sbatch run.slurm Submitted batch job 44075 nicolas.greneche@magi1:~$ cat slurm.out Thread 0 says: Hello World on core 6 Thread 0 reports: the number of threads are 4 Thread 1 says: Hello World on core 32 Thread 3 says: Hello World on core 1 Thread 2 says: Hello World on core 14

nicolas.greneche@magi1:~$ cat run.slurm #!/bin/bash #SBATCH –job-name=hello #SBATCH –output=slurm.out #SBATCH –error=slurm.err #SBATCH –nodes=2 #SBATCH –ntasks-per-node=2

srun ./hellompi

nicolas.greneche@magi1:~$ sbatch run.slurm Submitted batch job 44082 nicolas.greneche@magi1:~$ cat slurm.out Hello world from process 1 of 4 at magi66 Hello world from process 3 of 4 at magi75 Hello world from process 0 of 4 at magi66 Hello world from process 2 of 4 at magi75

submission_script.1637184238.txt.gz · Last modified: 2021/11/17 22:23 by nico