Slurm commands summary#
Run an interactive job
srun --nodes=1 --ntasks-per-node=1 --time=01:00:00 --pty bash -i --partition=debug
Run a job
sbatch run.sh
Example of run.sh
#!/bin/bash
# Define, how many nodes you need. Here, we ask for 1 node.
# Each node has 16 or 20 CPU cores.
#SBATCH --nodes=1
# Define the partition on which the job shall run. May be omitted.
#SBATCH --partition quiet
# --mem-per-cpu will define memory per CPU/core. Choose one of those.
#SBATCH --mem-per-cpu=1500MB
# The output file for your job.
#SBATCH --output=test-srun.out
# You may not place any commands before the last SBATCH directive
# Define and create a unique scratch directory for this job
SCRATCH_DIRECTORY=/scratch/${USER}/${SLURM_JOBID}
mkdir -p ${SCRATCH_DIRECTORY}
cd ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/myfiles*.txt ${SCRATCH_DIRECTORY}
# your command
time sleep 10
# After the job is done we copy our output back to $SLURM_SUBMIT_DIR
cp ${SCRATCH_DIRECTORY}/my_output ${SLURM_SUBMIT_DIR}
cd ${SLURM_SUBMIT_DIR}
rm -rf ${SCRATCH_DIRECTORY}
exit 0
Queue info
squeue
lists detailed information for a job
scontrol show jobid -dd <jobid>
statistics on completed jobs by jobID
sacct -j <jobid> --format=JobID,JobName,MaxRSS,Elapsed
Job deletion
scancel <job_id>
Cluster status
sinfo
More examples here : https://si-apc.pages.in2p3.fr/dante-cluster/userguide/