Before you start, outline the following three things for your computational task:
- How many threads (CPUs) you need
- Will often be passed to a
--threadsoption or similar - Using more than 32 in most cases will lead to slower execution times
- We'll call this quanity
$CPUS
- Will often be passed to a
- How much memory (RAM) you need
- Try to convert this into megabytes (MB)
- 32000 is a good starting place if you don't have a better estimate
- We'll call this quantity
$MEM
- How much time it will take
- Reformat this amount into the form
d-hh:mm:ss - Can't be longer than 2 weeks
- We'll call this quantity
$TIME
- Reformat this amount into the form
On the server, run
screento ensure a network glitch or power off doesn't interupt your work.
With the above in mind, run
salloc --cpus-per-task $CPUS --mem $MEM --time $TIMECongrats! If there are no error messages, then you are now in a SLURM shell. You can do anything here just like a regular shell, but you will be kicked out if you use more resources than you specified above. This allows you to run interative commands without interupting other people's intensive tasks.
If things are running for a long time, to leave, press CTRL+A and D. To go back later run
screen -rIf you have a script file to do your task for you, then you should use batch mode. Edit the script file and add the following to the top of it.
#!/bin/bash
#SBATCH --cpus-per-task=$CPUS
#SBATCH --mem=$MEM
#SBATCH --time=$TIMENow go to the command line and run
sbatch /path/to/script/file.shFor interactivity while running script files, use srun with the same flags as salloc with a script like sbatch.
Yeah, this one has its uses, but isn't really useful for most of our uses.