Created
March 9, 2022 19:45
-
-
Save MillironX/d817e01eee693d831a2dd25fbd3be0ce to your computer and use it in GitHub Desktop.
Revisions
-
MillironX created this gist
Mar 9, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ # SLURM Basics Before you start, outline the following three things for your computational task: 1. How many threads (CPUs) you need - Will often be passed to a `--threads` option or similar - Using more than 32 in most cases will lead to _slower_ execution times - We'll call this quanity `$CPUS` 2. 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` 3. 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` ## Interactive running On the server, run ```bash screen ``` to ensure a network glitch or power off doesn't interupt your work. With the above in mind, run ```bash salloc --cpus-per-task $CPUS --mem $MEM --time $TIME ``` Congrats! 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 <kbd>CTRL</kbd>+<kbd>A</kbd> and <kbd>D</kbd>. To go back later run ```bash screen -r ``` ## Batch running If 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. ```bash #!/bin/bash #SBATCH --cpus-per-task=$CPUS #SBATCH --mem=$MEM #SBATCH --time=$TIME ``` Now go to the command line and run ```bash sbatch /path/to/script/file.sh ``` ## Somewhere in-between For 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.