Open whophil opened 2 years ago
Hi @whophil , I've been looking into this today for myself. I just found out you can pass threads to your rule outside of the resources section, and it appears that it will get passed to SLURM as cpus-per-task
. On my cluster, I check resource allocation of this job (example below), and 8 CPUs have been allocated. Not sure if this is helpful or if you have already solved it, but I figured I'd mention it in case.
rule do_stuff:
input:
"file"
output:
"file"
threads: 8
resources:
partition="short",
mem_mb=int(100*1000), # MB, or 100 GB
runtime=int(10*60), # min, or 10 hours
shell:
"do stuff"
If you already know the exact Slurm flags you want to define, an alternative is to use my smk-simple-slurm profile. You can directly edit the example config.yaml
to pass --ntasks-per-node
to sbatch
, and also to set a default value for this resource. And the same applies to any other Slurm flag you might want to use.
Disclaimer: I am very new to Snakemake
I was trying to use this profile to submit a job using SLURM's
--ntasks-per-node
, and found that I needed to modifyRESOURCE_MAPPING
inslurm-submit.py
in order to do so. https://github.com/Snakemake-Profiles/slurm/blob/8ee65d648e502beba406059e2a2d026110d38b9a/%7B%7Bcookiecutter.profile_name%7D%7D/slurm-submit.py#L40-L46Other flags I often use which are not mapped include:
--cpus-per-task
,--threads-per-core
Is there any reason not to do this? If not, would a PR with said change be accepted?