Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is srun needed in a sbatch script for a single node/multicore job?

Tags:

slurm

I am running a very common bioinformatic tool/command bowtie2-build. It can use multi-threads on a single node (not a MPI type job). I have the following sbatch script (basically):

#!/bin/bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=6
#SBATCH --mem=15G
#SBATCH --time=3:00:00

bowtie2-build --threads $SLURM_CPUS_ON_NODE GRCh38.fa GRCh38

I read somewhere that whenever more than one CPUs are requested, srun must be used so that the last line above should be srun bowtie2-build ...? Is it true? I also learned that, for a MPI job, either srun or mpirun can be used to launch multiple processes. But I do need clarification on using srun in the case of single node with multi-threads. Thanks for any help!

(btw: I equated multi-threads with multi-cores in this particular context).

like image 947
nlong Avatar asked Oct 28 '25 20:10

nlong


1 Answers

For same-node computations (multithread, etc.) srun is not mandatory but using it offers better control and better feedback from Slurm.

If your program is started with srun, it will be easier for Slurm to manage it (send UNIX signals, kill it if it uses more resource than requested, etc.), and the sstat command will be able to provide you with near-real time memory usage, CPU efficiency, etc.

like image 171
damienfrancois Avatar answered Oct 31 '25 11:10

damienfrancois



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!