7
$\begingroup$

I do not understand how to specify correctly the parameters on aSLURM cluster forsnakemake to use them. I tried submitting the followingSLURM file, but it does not work this way and the number of cores used is only1, not20:

#!/bin/bash#SBATCH -p standard#SBATCH -A overall #SBATCH --time=12:00:00#SBATCH --output=snakemake%A.out#SBATCH --error=snakemake%A.err#SBATCH --nodes=1#SBATCH --ntasks=1#SBATCH --cpus-per-task=20#SBATCH --mem=120000snakemake

Then, I tried followingsnakemaketutorial. And createdcluster.json based on theSLURM parameters that I need:

{    "__default__" :    {        "A" : "overall",        "time" : "24:00:00",        "nodes": 1,        "ntasks": 1,        "cpus" : 20,        "p" : "standard",        "mem": 120000,        "output": "snakemake%A.out",        "error": "snakemake%A.err"    }}

And ransnakemake inside a newly createdsnakemake.sh script:

#!/bin/bashsnakemake -j 999 --cluster-config cluster.json --cluster "sbatch -A {cluster.A} -p {cluster.p} \ -t {cluster.time} --output {cluster.output} --error {cluster.error} -- nodes {cluster.nodes} \--ntasks {cluster.ntasks} --cpus-per-task {cluster.cpus} --mem {cluster.mem}"

And it is giving me an error now:

sbatch: error: Unable to open file
/bin/sh: line 1: -t: command not found Error submitting jobscript (exit code 127):

I am now completely lost at what I shoould actually do. I would prefer plain regular.slurm file submission, but how to makesnakemake use them? Any suggestions would be greatly appreciated.

I removed\ - line separators in thesnakemake.sh script:

#!/bin/bashsnakemake -j 10 --cluster-config cluster.json --cluster "sbatch -A {cluster.A} -p {cluster.p} -t {cluster.time} --output {cluster.output} --error {cluster.error} --nodes {cluster.nodes} --ntasks {cluster.ntasks} --cpus-per-task {cluster.cpus} --mem {cluster.mem}"

And it started to run. It is not convenient though for me. I would rather prefer submitting just one job using.slurm file passing all of the parameters from#SBATCH. Is it possible?

llrs's user avatar
llrs
4,7211 gold badge20 silver badges43 bronze badges
askedSep 5, 2018 at 1:16
Nikita Vlasenko's user avatar
$\endgroup$
4
  • $\begingroup$What does the %A mean?$\endgroup$CommentedFeb 27, 2019 at 22:59
  • 1
    $\begingroup$username who is in charge of the cluster account computation resources, their payment. You can be this user, but it can also be that it is the other person, depending on who is paying for the cluster.$\endgroup$CommentedFeb 27, 2019 at 23:19
  • $\begingroup$Can you use {rule} and {wildcards} in the output and error names in the slurm.json to name the output and error files of a job? so instead of "output": "snakemake%A.out", have ""output": "snakemake{rule}_{wilcards}.out"?$\endgroup$CommentedMar 9, 2019 at 0:12
  • $\begingroup$good question. idk, but i would also want to learn that since it simplifies things$\endgroup$CommentedMar 9, 2019 at 2:35

2 Answers2

10
$\begingroup$

You can omit--nodes, you need the following:

#!/bin/bash#SBATCH --ntasks-per-node=1#SBATCH -c threads_from_snakemake#SBATCH -p some_partitionCommands go here

For slurm, you may want to modify mySlurmEasy script. We use that with snakemake all the time, usually of the form:

snakemake -c "SlurmEasy -t {threads} -n {rule} --mem-per-cpu {cluster.memory}" ...

You'll also want units with your memory requests, like12G. Also, in general it's best not to submit snakemake itself to the cluster, rather run it on an interactive node and have it submit jobs on your behalf (if the admins complain point out that snakemake is barely using any resources on the head node).

answeredSep 5, 2018 at 7:05
Devon Ryan's user avatar
$\endgroup$
0
$\begingroup$

While I agree with not submitting snakemake to the cluster, it's not a great solution to make your pilot program run interactively - automation via batch script should not be dependent on an open shell.

How about allocating a whole node with many cores and working within the GNU parallel abilities of snakemake.

answeredFeb 11, 2020 at 15:45
Excel Que's user avatar
$\endgroup$

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.