Altering resource usage
This workflow sets a default number of threads and runtime for each rule. Memory
is not set per rule as development took place on clusters that did not allow
direct requests of memory when submitting SLURM jobs, instead always allocating
6.4GB RAM per core for each job. The easiest way to get up and running with this
workflow is to set --default-resources mem_mb="XXXX * threads"
when running
the Snakemake command, replacing XXXX
with the RAM available per core on your
HPC system in MB (in the case of ours, this was 6400). See the
profiles in the
GitHub repository as an example.
However, the default resources may not always work, your data may need more
memory, or longer runtimes, or maybe you even need shorter if your HPC has
shorter runtime limits than some of the defaults we set (up to 7 days).
Snakemake makes it easy to alter resources in the command line using the
--set-resources
and --set-threads
options, which will override anything set
in the workflow already.
This is even better set up in a profile. PopGLen includes a default profile in
the
profiles/default
folder, which has all the rules already populated with the default resources
already set. If you have downloaded the workflow via cloning the repository, all
you need to do is change the values to match your needs (which may require
adding an additional resource option, like mem_mb
). If you have downloaded via
Snakedeploy, just download the config file from the main repository, place it in
the same directory in your deployed workflow, modify as needed and Snakemake
will automatically pick it up when you run it.
Here is an example of what it would look like to change the number of threads
for the rule bwa_index
from the default of 1 to a new value of 5:
profiles/default/config.yaml | |
---|---|
1 2 3 4 5 6 7 8 |
|
And if you wanted to update the runtime to give it only a maximum of 1 day and add a limit of 2GB for memory:
profiles/default/config.yaml | |
---|---|
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
You can also use the term 'attempt' in these definitions, which allow you to scale the resources with the number of attempts a rule has made, automatically increasing threads, runtime, or memory with each attempt. This is already done for several rules in the config, largely to automatically request more memory due to OOM errors.