LSF to SLURM quick reference

This article shows the SLURM equivalent of LSF commands.

The SLURM Scheduler

SLURM  (formerly known as Simple Linux Utility for Resource Management or SLURM) is the job scheduler deployed on JASMIN. It allows users to submit, monitor, and control jobs on the CentOS7 LOTUS  sub-cluster.

Table 1 Essential LSF/SLURM commands

LSF   SLURM Description
bsub < script_file sbatch script_file Submit a job script to the scheduler
bsub  command-string sbatch  --wrap="user  command string" Invoke " command string" instead of submitting a job script
bqueues  sinfo Show available scheduling queues
bjobs  squeue List user's pending and running jobs

Table 2 Job specification 

LSF SLURM  Description
#BSUB #SBATCH Scheduler directive
-q queue_name

-p queue_name

Specify the scheduling queue
-W   hh:mm:ss --time= hh:mm:ss  or -t hh:mm:ss
Set the maximum runtime limit
-We  hh:mm:ss --time-min= hh:mm:ss  
Set an estimated runtime 
-J job_name --job-name= jobname
Specify a name for the job
-o filename,               -e filename

 


-oo/-eo  filename
--output= filename or -o filename, 
--error=filename or -e filename
The default file name is "slurm-%j.out", where  the  "%j"is  replaced  by  the  job  ID
For  job arrays,  the  default  file  name  is "slurm-%A_%a.out", "%A" is replaced by the job ID and "%a" with the array  index. 
--open-mode=append|truncate

Standard job output and error output. Default append.



     
Overwrite job error/output files 
%J 
%I 
%j 
%a 
Job ID   for -oo/eo filename
Job array index 
-R "rusage[mem= XXX]"
--mem= XXX  Memory XXX required for the job.  Default units are megabytes 
-J job_name[index_list] --array= index
(e.g. --array=1-10)
specify a job array 
-cwd directory -D, --chdir=<directory>
-x --exclusive Exclusive execution mode
-P project -A   project  Charge resources used by this job to the specified 

Table 3 Job control commands 

LSF SLURM Description
bkill  jobid scancel  jobid  Kill a job 
bjobs -l jobid scontrol show job jobid Show details job  information
bmod  jobid scontrol update job jobid Modify a pending job


Table 4 Job environment variables

LSF SLURM Description 
$LSB_JOBID $SLURM_JOBID Job identifier number 
$LSB_JOBID
$SLURM_ARRAY_JOB_ID Job array 
$LSB_JOBINDEX $SLURM_ARRAY_TASK_ID Job array index
$LSB_JOBINDEX_END $SLURM_ARRAY_TASK_MAX Last index number within a job array
$LSB_MAX_NUM_PROCESSORS $SLURM_NTASKS Number of processors allocated

Still need help? Contact Us Contact Us