User Tools

Site Tools


submission_script

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
submission_script [2021/11/17 22:23] nicosubmission_script [2021/11/17 22:29] nico
Line 1: Line 1:
 +===== 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 : 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 :
  
Line 9: Line 11:
   #SBATCH --mail-user=nicolas.greneche@univ-paris13.fr   #SBATCH --mail-user=nicolas.greneche@univ-paris13.fr
   #SBATCH --nodes=2   #SBATCH --nodes=2
 +  
   srun hostname   srun hostname
  
Line 23: Line 25:
   magi75   magi75
  
 +===== OpenMP job script =====
  
 +Here is a simple script for OpenMP :
  
-nicolas.greneche@magi1:~$ cat run.slurm +  nicolas.greneche@magi1:~$ cat run.slurm 
-#!/bin/bash +  #!/bin/bash 
-#SBATCH --job-name=OMP_hello +  #SBATCH --job-name=OMP_hello 
-#SBATCH --output=slurm.out +  #SBATCH --output=slurm.out 
-#SBATCH --error=slurm.err +  #SBATCH --error=slurm.err 
-#SBATCH --partition=COMPUTE-SHORT +  #SBATCH --partition=COMPUTE-SHORT 
-#SBATCH --nodes=1 +  #SBATCH --nodes=1 
-#SBATCH --ntasks-per-node=1 +  #SBATCH --ntasks-per-node=1 
-#SBATCH --cpus-per-task=4+  #SBATCH --cpus-per-task=4 
 +   
 +  export OMP_NUM_THREADS=4 
 +  srun hello_openmp
  
-export OMP_NUM_THREADS=4 +We submit it :
-srun -l hello_openmp+
  
-nicolas.greneche@magi1:~$ sbatch run.slurm +  nicolas.greneche@magi1:~$ sbatch run.slurm 
-Submitted batch job 44075 +  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 +And check the output :
-#!/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:~$ 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:~$ sbatch run.slurm +  nicolas.greneche@magi1:~$ cat run.slurm 
-Submitted batch job 44082 +  #!/bin/bash 
-nicolas.greneche@magi1:~$ cat slurm.out +  #SBATCH --job-name=hello 
-Hello world from process 1 of 4 at magi66 +  #SBATCH --output=slurm.out 
-Hello world from process 3 of 4 at magi75 +  #SBATCH --error=slurm.err 
-Hello world from process 0 of 4 at magi66 +  #SBATCH --nodes=2 
-Hello world from process of 4 at magi75 +  #SBATCH --ntasks-per-node=
 +   
 +  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
submission_script.txt · Last modified: 2021/11/17 22:30 by nico