Skip to content

Commit

Permalink
Merge pull request #12 from carpentries-incubator/cluster_snakefiles
Browse files Browse the repository at this point in the history
Cluster snakefiles
  • Loading branch information
tkphd authored Dec 21, 2023
2 parents c6ba6d1 + 3cb2dfb commit a4d7b63
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions episodes/files/Snakefile_cluster_iteration
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Run a bunch of Amdahl jobs and aggregate the output.
#
WIDTHS=[1,2]
#
def getwidth(wildcards):
return wildcards.sample

rule plot:
input: expand('{size}.out',size=WIDTHS)
output: 'done.out'
resources:
mpi="mpirun",
tasks=1
shell: 'echo "{WIDTHS}, Done!" > done.out'
rule iterate:
input:
output: '{sample}.out'
resources:
mpi="mpirun",
tasks=getwidth
shell:
"module load OpenMPI; mpirun -np {resources.tasks} amdahl > {wildcards.sample}.out"

13 changes: 13 additions & 0 deletions episodes/files/Snakefile_iterative
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Iterative example.
#
NAMES=['one','two','three']
#
rule done:
input: expand('{name}.out',name=NAMES)
output: 'done.out'
shell: 'echo "Done!" > done.out'
rule iterate:
input:
output: '{sample}.out'
shell: 'echo {output} > {output}'
6 changes: 6 additions & 0 deletions episodes/files/queuing_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# snakemake -j 3 --cluster "sbatch -N 1 -n {resources.tasks} -p node"
cluster:
sbatch
--partition=node
--nodes=1
--tasks={resources.tasks}

0 comments on commit a4d7b63

Please sign in to comment.