forked from CasparJungbacker/Master-Thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
155 lines (139 loc) · 4.97 KB
/
Snakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import os
HERE = os.getcwd()
PLOT_DIR = os.path.join(HERE, "doc", "images", "plots")
def aggregate_grid_sizes(wildcards):
sysdir = os.path.join(HERE, "data", "benchmarks", "walltime", wildcards.system, wildcards.precision)
grid_sizes = [os.path.join(sysdir, _, "output_" + wildcards.processor + ".txt") \
for _ in os.listdir(sysdir) if os.path.isdir(os.path.join(sysdir, _))]
return sorted(grid_sizes)
def aggregate_ensemble_members(wildcards):
ensembledir = os.path.join(HERE, "data", "ensembles", "members")
members = [os.path.join(ensembledir, wildcards.processor, _, wildcards.file + ".001.nc") \
for _ in os.listdir(os.path.join(ensembledir, wildcards.processor)) \
if os.path.isdir(os.path.join(ensembledir, wildcards.processor, _))]
return members
wildcard_constraints:
system="[a-z]+",
precision="[a-z]+"
rule all:
input:
"doc/images/plots/speedup_snellius.svg",
"doc/images/plots/speedup_wiske.svg",
"doc/images/plots/strong_scaling.svg",
"doc/images/plots/verify_profiles.svg",
"doc/images/plots/weak_scaling.svg",
"doc/images/plots/single_vs_double_precision.svg",
"doc/images/plots/gpu_in_top500.svg",
"doc/images/plots/speedup_per_module.svg"
rule walltimes:
input:
expand("data/benchmarks/walltime/{system}/doubleprecision/walltime_{system}_{processor}_doubleprecision.csv",
system=["snellius", "wiske"],
processor=["gpu", "single_cpu", "multi_cpu"]),
"data/benchmarks/walltime/wiske/singleprecision/walltime_wiske_gpu_singleprecision.csv"
rule plots:
input:
expand(os.path.join(PLOT_DIR, "speedup_{system}.svg"), system=["snellius", "wiske"]),
"doc/images/plots/strong_scaling.svg"
rule aggregate_walltime:
input:
script="scripts/utils/get_runtimes.py",
files=aggregate_grid_sizes
output:
"data/benchmarks/walltime/{system}/{precision}/walltime_{system}_{processor}_{precision}.csv"
shell:
"python {input.script} -i {input.files} -o {output}"
rule generate_ensemble:
input:
aggregate_ensemble_members
output:
"data/ensembles/{file}.{processor}.nc"
shell:
"ncecat {input} -O {output}"
rule plot_speedup:
input:
script="scripts/plots/plot_speedup.py",
mplrc="matplotlibrc",
timing_single_core="data/benchmarks/walltime/{system}/doubleprecision/walltime_{system}_single_cpu_doubleprecision.csv",
timing_multi_core="data/benchmarks/walltime/{system}/doubleprecision/walltime_{system}_multi_cpu_doubleprecision.csv",
timing_gpu="data/benchmarks/walltime/{system}/doubleprecision/walltime_{system}_gpu_doubleprecision.csv"
output:
"doc/images/plots/speedup_{system}.svg"
shell:
"""
python {input.script} \
-s {input.timing_single_core} \
-m {input.timing_multi_core} \
-g {input.timing_gpu} \
-o {output}
"""
rule plot_strong_scaling:
input:
script="scripts/plots/plot_strong_scaling.py",
mplrc="matplotlibrc",
run_output=expand("data/benchmarks/strongscaling/output_{ngpus}.txt",
ngpus=glob_wildcards("data/benchmarks/strongscaling/output_{ngpus}.txt").ngpus)
output:
"doc/images/plots/strong_scaling.svg"
shell:
"python {input.script} -i {input.run_output} -o {output}"
rule plot_verification:
input:
script="scripts/plots/plot_verification.py",
mplrc="matplotlibrc",
profiles_cpu="data/ensembles/profiles.cpu.nc",
profiles_gpu="data/ensembles/profiles.gpu.nc"
output:
"doc/images/plots/verify_profiles.svg"
shell:
"python {input.script} -c {input.profiles_cpu} -g {input.profiles_gpu} -o {output}"
rule plot_weak_scaling:
input:
script="scripts/plots/plot_weak_scaling.py",
mplrc="matplotlibrc",
output_pencils=expand("data/benchmarks/weakscaling/pencils/output_{ngpus}.txt",
ngpus=glob_wildcards("data/benchmarks/weakscaling/pencils/output_{ngpus}.txt").ngpus),
output_slabs=expand("data/benchmarks/weakscaling/slabs/output_{ngpus}.txt",
ngpus=glob_wildcards("data/benchmarks/weakscaling/slabs/output_{ngpus}.txt").ngpus),
output:
"doc/images/plots/weak_scaling.svg"
shell:
"""
python {input.script} \
-p {input.output_pencils} \
-s {input.output_slabs} \
-o {output}
"""
rule plot_single_vs_double:
input:
script="scripts/plots/plot_single_vs_double_precision.py",
mplrc="matplotlibrc",
single="data/benchmarks/walltime/wiske/singleprecision/walltime_wiske_gpu_singleprecision.csv",
double="data/benchmarks/walltime/wiske/doubleprecision/walltime_wiske_gpu_doubleprecision.csv"
output:
"doc/images/plots/single_vs_double_precision.svg"
shell:
"""
python {input.script} \
-s {input.single} \
-d {input.double} \
-o {output}
"""
rule plot_gpu_top500:
input:
script="scripts/plots/plot_top500.py",
mplrc="matplotlibrc",
data="data/TOP500_history.csv"
output:
"doc/images/plots/gpu_in_top500.svg"
shell:
"python {input.script} -i {input.data} -o {output}"
rule plot_speedup_per_module:
input:
script="scripts/plots/plot_speedup_per_module.py",
mplrc="matplotlibrc",
data="data/benchmarks/communication/comm_times.csv",
output:
"doc/images/plots/speedup_per_module.svg"
shell:
"python {input.script} -i {input.data} -o {output}"