Difference between revisions of "LSF to Slurm quick reference"

From ScientificComputing
Jump to: navigation, search
(Introduction)
Line 20: Line 20:
 
  # load modules
 
  # load modules
 
  # run command
 
  # run command
| <tt>jobscdript.sh:</tt><br />
+
| <tt>jobscript.sh:</tt><br />
 
  #!/bin/bash
 
  #!/bin/bash
 
   
 
   
 
  #SBATCH -n 4
 
  #SBATCH -n 4
 
  #SBATCH --time=8:00
 
  #SBATCH --time=8:00
  #SBATCH --mem=2G
+
  #SBATCH --mem-per-cpu=2G
 
  #SBATCH --job-name=analysis1
 
  #SBATCH --job-name=analysis1
 
  #SBATCH --output=analysis1.out
 
  #SBATCH --output=analysis1.out
  #SBATCH --errot=analysis1.err
+
  #SBATCH --error=analysis1.err
 
   
 
   
 
  # load modules
 
  # load modules

Revision as of 08:49, 31 March 2022

Introduction

The commands for slurm are similar to the ones used in LSF. You can find a mapping of the relevant commands below.

Submitting a job

LSF Slurm
bsub < jobscript.sh sbatch jobscript.sh
jobscript.sh:
#!/bin/bash

#BSUB -n 4
#BSUB -W 08:00
#BSUB -R "rusage[mem=2000]"
#BSUB -J analysis1
#BSUB -o analysis1.out
#BSUB -e analysis1.err

# load modules
# run command
jobscript.sh:
#!/bin/bash

#SBATCH -n 4
#SBATCH --time=8:00
#SBATCH --mem-per-cpu=2G
#SBATCH --job-name=analysis1
#SBATCH --output=analysis1.out
#SBATCH --error=analysis1.err

# load modules
# run command

Interactive job

LSF Slurm
bsub -Is [LSF options] bash __FIX_ME__

Monitoring a job

LSF Slurm
bjobs [JOBID] squeue [JOBID]

Killing a job

LSF Slurm
bkill [JOBID] scancel [JOBID]

Environment variables

LSF Slurm
$LSB_JOBID $SLURM_JOBID
$LSB_SUBCWD $SLURM_SUBMIT_DIR