cc_staff
290
edits
No edit summary |
|||
Line 839: | Line 839: | ||
The sbatch man page (type <tt>man sbatch</tt> on Niagara) explains all possible mail-types. | The sbatch man page (type <tt>man sbatch</tt> on Niagara) explains all possible mail-types. | ||
== Example submission script (MPI) == <!--T:90--> | == Example submission script (MPI) == <!--T:90--> | ||
Line 910: | Line 875: | ||
<li>To use hyperthreading, just change <tt>--ntasks=320</tt> to <tt>--ntasks=640</tt>, and add <tt>--bind-to none</tt> to the mpirun command (the latter is necessary for OpenMPI only, not when using IntelMPI).</li> | <li>To use hyperthreading, just change <tt>--ntasks=320</tt> to <tt>--ntasks=640</tt>, and add <tt>--bind-to none</tt> to the mpirun command (the latter is necessary for OpenMPI only, not when using IntelMPI).</li> | ||
</ul> | </ul> | ||
== Example submission script (OpenMP) == <!--T:87--> | |||
<!--T:88--> | |||
Suppose you want to run a single-node, multi-threaded application called <tt>appl_openmp_ex</tt> that uses [[OpenMP]]. The job script could look as follows: | |||
</translate> | |||
<source lang="bash">#!/bin/bash | |||
#SBATCH --nodes=1 | |||
#SBATCH --cpus-per-task=40 | |||
#SBATCH --time=1:00:00 | |||
#SBATCH --job-name openmp_ex | |||
#SBATCH --output=openmp_ex_%j.txt | |||
cd $SLURM_SUBMIT_DIR | |||
module load intel/2018.2 | |||
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK | |||
./appl_openmp_ex | |||
</source> | |||
<translate> | |||
<!--T:89--> | |||
Submit this script (if it is called openmp_ex.sh) with the command: | |||
<source lang="bash">nia-login07:~$ sbatch openmp_ex.sh</source> | |||
* First line indicates that this is a bash script. | |||
* Lines starting with <code>#SBATCH</code> go to SLURM. | |||
* sbatch reads these lines as a job request (which it gives the name <code>openmp_ex</code>) . | |||
* In this case, SLURM looks for one node with 40 cores to be run inside one task, for 1 hour. | |||
* Once it found such a node, it runs the script: | |||
** Change to the submission directory; | |||
** Loads modules (must be done again in the submission script on Niagara); | |||
** Sets an environment variable to set the number of threads to 40 (no hyperthreading in this example); | |||
** Runs the <code>appl_openmp_ex</code> application. | |||
* To use hyperthreading, just change <tt>--cpus-per-task=40</tt> to <tt>--cpus-per-task=80</tt>. | |||
= Monitoring queued jobs = <!--T:92--> | = Monitoring queued jobs = <!--T:92--> |