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:17] nicosubmission_script [2021/11/17 22:29] nico
Line 1: Line 1:
-A submission file script contains all the information required by SLURM in order to launch your job. We will detail a versy simple script that launch+===== Simple job script =====
  
-nicolas.greneche@magi1:~$ cat hostname.slurm +A submission file script contains all the information required by SLURM in order to launch your jobWe will detail a very simple script that launch "hostname" on two hosts :
-#!/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+  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 +  nicolas.greneche@magi1:~$ sbatch hostname.slurm 
-Submitted batch job 44066+  Submitted batch job 44066
  
-nicolas.greneche@magi1:~$ cat slurm.out +And we check the output :
-magi66 +
-magi75+
  
-nicolas.greneche@magi1:~$ cat run.slurm +  nicolas.greneche@magi1:~$ cat slurm.out 
-#!/bin/bash +  magi66 
-#SBATCH --job-name=OMP_hello +  magi75
-#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=+===== OpenMP job script =====
-srun -l hello_openmp+
  
-nicolas.greneche@magi1:~$ sbatch run.slurm +Here is a simple script for OpenMP :
-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 +  nicolas.greneche@magi1:~$ cat run.slurm 
-#!/bin/bash +  #!/bin/bash 
-#SBATCH --job-name=hello +  #SBATCH --job-name=OMP_hello 
-#SBATCH --output=slurm.out +  #SBATCH --output=slurm.out 
-#SBATCH --error=slurm.err +  #SBATCH --error=slurm.err 
-#SBATCH --nodes=2 +  #SBATCH --partition=COMPUTE-SHORT 
-#SBATCH --ntasks-per-node=2+  #SBATCH --nodes=1 
 +  #SBATCH --ntasks-per-node=
 +  #SBATCH --cpus-per-task=4 
 +   
 +  export OMP_NUM_THREADS=4 
 +  srun hello_openmp
  
-srun ./hellompi+We submit it :
  
 +  nicolas.greneche@magi1:~$ sbatch run.slurm
 +  Submitted batch job 44075
  
-nicolas.greneche@magi1:~$ sbatch run.slurm +And check the output :
-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+
  
 +  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
 +  
 +  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