Contents
Common Job Scenarios
The most common mistake for new users is overcomplicating CPU and task requests. In most non-MPI jobs, keep --ntasks=1 and scale with --cpus-per-task.
Scenario 1: Single-threaded Program
Use this for Python, R, MATLAB, shell, or compiled programs that use only one CPU core.
#!/bin/bash -l
#SBATCH --partition=scu-cpu
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --time=02:00:00
python my_script.pyScenario 2: Multi-threaded Program
Use this for tools that support threads, such as programs with a --threads, -t, or OpenMP setting.
#!/bin/bash -l
#SBATCH --partition=scu-cpu
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=16G
#SBATCH --time=04:00:00
export OMP_NUM_THREADS=8
./my_program --threads 8Scenario 3: GPU Job
#!/bin/bash -l
#SBATCH --partition=scu-gpu
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=32G
#SBATCH --gres=gpu:1
#SBATCH --time=12:00:00
python train_model.pyScenario 4: Cryo-EM GPU Job
#!/bin/bash -l
#SBATCH --partition=cryo-gpu
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=64G
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
module load relion/3.1.0/gpu
relion_refine_mpi ...Scenario 5: Job Array
#!/bin/bash -l
#SBATCH --job-name=array_job
#SBATCH --array=1-100
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=2G
#SBATCH --time=01:00:00
# Use the SLURM_ARRAY_TASK_ID to process different files
python process_data.py --input sample_${SLURM_ARRAY_TASK_ID}.txt