diff --git a/episodes/files/Snakefile_cluster_iteration b/episodes/files/Snakefile_cluster_iteration new file mode 100644 index 0000000..41a94a2 --- /dev/null +++ b/episodes/files/Snakefile_cluster_iteration @@ -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" + diff --git a/episodes/files/Snakefile_iterative b/episodes/files/Snakefile_iterative new file mode 100644 index 0000000..8fe13f8 --- /dev/null +++ b/episodes/files/Snakefile_iterative @@ -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}' diff --git a/episodes/files/queuing_config.yaml b/episodes/files/queuing_config.yaml new file mode 100644 index 0000000..7db5043 --- /dev/null +++ b/episodes/files/queuing_config.yaml @@ -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}