I want to be able to set cores, threads, and RAM in some way that I don’t have to hard-code the numbers for each job.
Slurm, our job scheduler, provides a number of environment variables that you can include in your job script to dynamically access the number of cores and amount of memory your job request.
$SLURM_CPUS_PER_TASK
= --cpus-per-task
$SLURM_NTASKS
= --ntasks
$SLURM_JOB_NUM_NODES
= --nodes
$SLURM_MEM_PER_CPU
= --mem-per-cpu
$SLURM_MEM_PER_NODE
= --mem`