===== Simple job script ===== 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 ===== OpenMP job script ===== Here is a simple script for OpenMP : 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 hello_openmp We submit it : nicolas.greneche@magi1:~$ sbatch run.slurm Submitted batch job 44075 And check the output : 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 ===== MPI job script ===== 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 module load gcc/8.3.0/openmpi/3.1.4 srun ./hellompi We submit it : nicolas.greneche@magi1:~$ sbatch run.slurm Submitted batch job 44082 And check the output : 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