aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/plot-benchmarks.py
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-11-22 17:09:58 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2026-11-22 17:09:58 +0100
commitd0f311a6dc9478de5202f861d7b4502c266c9005 (patch)
tree0babe7724d7641ab25277e60099bf347214d64fa /benchmarks/plot-benchmarks.py
parent8e3088997f43fb02d9b657f7e9d32ddd44d7d940 (diff)
downloadnissy-core-d0f311a6dc9478de5202f861d7b4502c266c9005.tar.gz
nissy-core-d0f311a6dc9478de5202f861d7b4502c266c9005.zip
Update benchmarks and commentbenchmark-egg
Diffstat (limited to 'benchmarks/plot-benchmarks.py')
-rw-r--r--benchmarks/plot-benchmarks.py77
1 files changed, 60 insertions, 17 deletions
diff --git a/benchmarks/plot-benchmarks.py b/benchmarks/plot-benchmarks.py
index dfd1f90..e72e13b 100644
--- a/benchmarks/plot-benchmarks.py
+++ b/benchmarks/plot-benchmarks.py
@@ -185,9 +185,9 @@ with open(benchmarks_4_threads, "w") as f:
185 ) 185 )
186 f.write("\n") 186 f.write("\n")
187 f.write( 187 f.write(
188 '<img src="img/H48_4_threads_speedup_factor.png">\n' 188 '<img src="img/H48_4_threads_speedup_factor.png">\n'
189 '<img src="img/egg_4_threads_speedup_factor.png">\n' 189 '<img src="img/egg_4_threads_speedup_factor.png">\n'
190 ) 190 )
191 f.write("\n") 191 f.write("\n")
192 f.write("</details>\n") 192 f.write("</details>\n")
193 193
@@ -223,9 +223,9 @@ with open(benchmarks_16_threads, "w") as f:
223 ) 223 )
224 f.write("\n") 224 f.write("\n")
225 f.write( 225 f.write(
226 '<img src="img/H48_16_threads_speedup_factor.png">\n' 226 '<img src="img/H48_16_threads_speedup_factor.png">\n'
227 '<img src="img/egg_16_threads_speedup_factor.png">\n' 227 '<img src="img/egg_16_threads_speedup_factor.png">\n'
228 ) 228 )
229 f.write("\n") 229 f.write("\n")
230 f.write("</details>\n") 230 f.write("</details>\n")
231 231
@@ -241,14 +241,35 @@ with open(benchmarks_all_solutions, "w") as f:
241 f.write("\n") 241 f.write("\n")
242 f.write("Time per cube (in seconds, lower is better).\n") 242 f.write("Time per cube (in seconds, lower is better).\n")
243 f.write("\n") 243 f.write("\n")
244 print_table(f, results_h48.h48_all_solutions, None, None, False, False) 244 print_table(
245 f,
246 results_h48.h48_all_solutions,
247 None,
248 results_egg.egg_all_solutions,
249 False,
250 False,
251 )
245 f.write("\n") 252 f.write("\n")
246 f.write( 253 f.write(
247 "Time per cube adjusted for table size " 254 "Time per cube adjusted for table size "
248 "(in seconds \\* GiB, lower is better).\n" 255 "(in seconds \\* GiB, lower is better).\n"
249 ) 256 )
250 f.write("\n") 257 f.write("\n")
251 print_table(f, results_h48.h48_all_solutions, None, None, True, False) 258 print_table(
259 f,
260 results_h48.h48_all_solutions,
261 None,
262 results_egg.egg_all_solutions,
263 True,
264 False
265 )
266 f.write("\n")
267 f.write(
268 '<img src="img/17movesallsolutions16threads.png">\n'
269 '<img src="img/18movesallsolutions16threads.png">\n'
270 '<img src="img/19movesallsolutions16threads.png">\n'
271 '<img src="img/20movesallsolutions16threads.png">\n'
272 )
252 f.write("\n") 273 f.write("\n")
253 f.write("</details>\n") 274 f.write("</details>\n")
254 275
@@ -256,20 +277,33 @@ with open(benchmarks_all_solutions, "w") as f:
256 277
257def plot_comparison(title, hd, vd, ed, key): 278def plot_comparison(title, hd, vd, ed, key):
258 d = 1 if key == "superflip" else 25 279 d = 1 if key == "superflip" else 25
259 h48x = [sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m]]
260 vcubex = [sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m]]
261 eggx = [sizes_egg[m]/(2**30) for m in ed.keys() if key in ed[m]]
262 h48y = [d[key] for _, d in hd.items() if key in d]
263 vcubey = [d[key] for _, d in vd.items() if key in d]
264 eggy = [d[key] for _, d in ed.items() if key in d]
265 280
266 plt.clf() 281 plt.clf()
267 plt.title(title) 282 plt.title(title)
268 plt.xlabel("Table size (GiB)") 283 plt.xlabel("Table size (GiB)")
269 plt.ylabel("Time to solve (s / cube)") 284 plt.ylabel("Time to solve (s / cube)")
270 plt.plot(h48x, h48y, "o--", label = "H48") 285
271 plt.plot(vcubex, vcubey, "o--", label = "vcube") 286 if hd is not None:
272 plt.plot(eggx, eggy, "o--", label = "egg") 287 h48x = [
288 sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m]
289 ]
290 h48y = [d[key] for _, d in hd.items() if key in d]
291 plt.plot(h48x, h48y, "o--", label = "H48")
292
293 if vd is not None:
294 vcubex = [
295 sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m]
296 ]
297 vcubey = [d[key] for _, d in vd.items() if key in d]
298 plt.plot(vcubex, vcubey, "o--", label = "vcube")
299
300 if ed is not None:
301 eggx = [
302 sizes_egg[m]/(2**30) for m in ed.keys() if key in ed[m]
303 ]
304 eggy = [d[key] for _, d in ed.items() if key in d]
305 plt.plot(eggx, eggy, "o--", label = "egg")
306
273 plt.legend(loc = "right") 307 plt.legend(loc = "right")
274 filename = title.replace(" ", "").replace(",", "") + ".png" 308 filename = title.replace(" ", "").replace(",", "") + ".png"
275 plt.savefig(benchmarks_img_dir / filename, dpi=300) 309 plt.savefig(benchmarks_img_dir / filename, dpi=300)
@@ -278,8 +312,17 @@ def plot_comparison(title, hd, vd, ed, key):
278rh = results_h48.h48_single_thread 312rh = results_h48.h48_single_thread
279rv = results_vcube.vcube_single_thread 313rv = results_vcube.vcube_single_thread
280re = results_egg.egg_single_thread 314re = results_egg.egg_single_thread
315rhall = results_h48.h48_all_solutions
316reall = results_egg.egg_all_solutions
281for m in [17, 18, 19, 20]: 317for m in [17, 18, 19, 20]:
282 plot_comparison(f"{m} moves 1 thread", rh, rv, re, m) 318 plot_comparison(f"{m} moves 1 thread", rh, rv, re, m)
319 plot_comparison(
320 f"{m} moves all solutions, 16 threads",
321 rhall,
322 None,
323 reall,
324 m,
325 )
283 326
284def plot_multithread_scatter(title, slow, fast): 327def plot_multithread_scatter(title, slow, fast):
285 plt.clf() 328 plt.clf()

Generated with cgit - Back to sebastiano.tronto.net