44 'cell size' : [ (xdata, ydata) for aos, (xdata, ydata) for soa ],
51 for CELL_SIZE
in CELL_SIZES:
53 for SOA
in [
False,
True]:
57 file_name = f
"{folder_name}/out-{'x64' if 'gi001' in folder_name else 'aarch64'}-soa{'true' if SOA else 'false'}-cell{CELL_SIZE}.log"
58 file = open( file_name,
"r" )
61 if "Experiment:" in line:
62 number_of_particles = line.split(
"Experiment:" )[1].split(
"particles" )[0]
63 particle_counts.append( float(number_of_particles) )
64 if kernel_name
in line:
65 time = line.split( kernel_name +
":" )[1].split(
"(" )[0]
66 timings.append( float(time) )
68 assert len(particle_counts)==len(timings)
or len(timings)==0,
"array dimensions don't match: {} vs {} for kernel {} in {}".format(particle_counts, timings, kernel_name, file_name)
69 result += [(particle_counts, timings)]
70 results[CELL_SIZE] = result
79 'cell size' : [ (xdata, ydata) for aos - always empty, (xdata, ydata) for soa ],
86 for CELL_SIZE
in CELL_SIZES:
91 file_name = f
"{folder_name}/out-{'gh' if 'gn003' in folder_name else 'mi300a'}-soatrue-cell{CELL_SIZE}.log"
92 file = open( file_name,
"r" )
95 if "Experiment:" in line:
96 number_of_particles = line.split(
"Experiment:" )[1].split(
"particles" )[0]
97 particle_counts.append( float(number_of_particles) )
98 if kernel_name
in line:
99 time = line.split( kernel_name +
":" )[1].split(
"(" )[0]
100 timings.append( float(time) )
102 assert len(particle_counts)==len(timings),
"array dimensions don't match: {} vs {} for kernel {} in {}".format(particle_counts, timings, kernel_name, file_name)
103 result += [(particle_counts, timings)]
104 results[CELL_SIZE] = result
113 'cell size' : [ (xdata, ydata) for aos - always empty, (xdata, ydata) for soa ],
120 for CELL_SIZE
in CELL_SIZES:
125 file_name = f
"{folder_name}/out-{'gh' if 'gn003' in folder_name else 'mi300a'}-soatrue-cell{CELL_SIZE}-shmem.log"
126 file = open( file_name,
"r" )
129 if "Experiment:" in line:
130 number_of_particles = line.split(
"Experiment:" )[1].split(
"particles" )[0]
131 particle_counts.append( float(number_of_particles) )
132 if kernel_name
in line:
133 time = line.split( kernel_name +
":" )[1].split(
"(" )[0]
134 timings.append( float(time) )
136 assert len(particle_counts)==len(timings),
"array dimensions don't match: {} vs {} for kernel {} in {}".format(particle_counts, timings, kernel_name, file_name)
137 result += [(particle_counts, timings)]
138 results[CELL_SIZE] = result
293 print( f
"process folder {folder_name}" )
295 for k, kernel
in enumerate(Kernels):
296 for im, implementation
in enumerate(ImplementationVariant[kernel]):
297 if '#' in implementation:
continue
299 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
302 mpl.rcParams.update(params)
304 cell_size_legend_handles = []
305 cell_size_legend_labels = []
306 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
307 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[cs], color=Colors[cs], label=f
'{int(CELL_SIZE)}', linestyle=
'-')]
308 cell_size_legend_labels += [f
'{int(CELL_SIZE)}']
310 impl_data_aos = impl_data_all[CELL_SIZE][0]
311 plt.plot( impl_data_aos[0],
316 linestyle=LineStyles[
'aos']
319 impl_data_soa = impl_data_all[CELL_SIZE][1]
320 plt.plot( impl_data_soa[0],
325 linestyle=LineStyles[
'soa']
328 plt.xlabel(
"Particles")
329 plt.ylabel(
"Time per particle update [t]=s")
331 plt.xscale(
'log', base=10)
332 plt.yscale(
'log', base=10)
334 if 'density' in kernel: plt.ylim(2e-7, 2e-5)
337 plt.grid(
True, which=
'both')
339 filename = f
"/{kernel}_{implementation}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
340 filename = f
"{folder_name}/{filename}"
342 if 'gi001' in filename:
343 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
344 elif 'gn003' in filename:
345 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
347 raise Exception(
"I don't know what CPU I'm working on!")
349 plt.savefig(f
"{filename}.pdf")
350 plt.savefig(f
"{filename}.png")
355 fig_legend = plt.figure(figsize=(10, 1))
356 ax_legend = fig_legend.add_subplot(111)
357 ax_legend.axis(
"off")
358 ax_legend.legend(handles=cell_size_legend_handles, labels=cell_size_legend_labels, loc=
"center", ncol=5, frameon=
False)
359 fig_legend.savefig(f
"{folder_name}/cell_legend.pdf", bbox_inches=
'tight', dpi=300)
360 fig_legend.savefig(f
"{folder_name}/cell_legend.png", bbox_inches=
'tight', dpi=300)
362 fig_legend = plt.figure(figsize=(4, 1))
363 ax_legend = fig_legend.add_subplot(111)
364 ax_legend.axis(
"off")
365 ax_legend.legend(handles=[
366 Line2D([0], [0], color=
'black', label=
'AoS', linestyle=LineStyles[
'aos']),
367 Line2D([0], [0], color=
'black', label=
'SoA', linestyle=LineStyles[
'soa'])
368 ], labels=[
'AoS',
'SoA'], loc=
"center", ncol=2, frameon=
False)
369 fig_legend.savefig(f
"{folder_name}/layout_legend.pdf", bbox_inches=
'tight', dpi=300)
370 fig_legend.savefig(f
"{folder_name}/layout_legend.png", bbox_inches=
'tight', dpi=300)
377 print( f
"process folder {folder_name}" )
379 for k, kernel
in enumerate(Kernels):
380 for im, implementation
in enumerate(ImplementationVariant_GPU[kernel]):
381 if '#' in implementation:
continue
383 impl_data_all =
read_data_gpu(folder_name, f
"{kernel}-gpu {implementation}")
386 mpl.rcParams.update(params)
388 cell_size_legend_handles = []
389 cell_size_legend_labels = []
390 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
391 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[cs], color=Colors[cs], label=f
'{int(CELL_SIZE)}', linestyle=
'-')]
392 cell_size_legend_labels += [f
'{int(CELL_SIZE)}']
403 impl_data_soa = impl_data_all[CELL_SIZE][1]
404 plt.plot( impl_data_soa[0],
409 linestyle=LineStyles[
'soa']
412 plt.xlabel(
"Particles")
413 plt.ylabel(
"Time per particle update [t]=s")
415 plt.xscale(
'log', base=10)
416 plt.yscale(
'log', base=10)
418 if 'density' in kernel: plt.ylim(2e-7, 2e-5)
419 if 'drift' in kernel: plt.ylim(7e-8, 4e-6)
422 plt.grid(
True, which=
'both')
424 filename = f
"/{kernel}_gpu_{implementation}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
425 filename = f
"{folder_name}/{filename}"
427 if 'gi001' in filename:
428 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
429 elif 'gn003' in filename:
430 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
431 elif 'mi300a' in filename:
434 raise Exception(
"I don't know what CPU I'm working on!")
436 plt.savefig(f
"{filename}.pdf")
437 plt.savefig(f
"{filename}.png")
442 fig_legend = plt.figure(figsize=(10, 1))
443 ax_legend = fig_legend.add_subplot(111)
444 ax_legend.axis(
"off")
445 ax_legend.legend(handles=cell_size_legend_handles, labels=cell_size_legend_labels, loc=
"center", ncol=5, frameon=
False)
446 fig_legend.savefig(f
"{folder_name}/cell_legend.pdf", bbox_inches=
'tight', dpi=300)
447 fig_legend.savefig(f
"{folder_name}/cell_legend.png", bbox_inches=
'tight', dpi=300)
449 fig_legend = plt.figure(figsize=(4, 1))
450 ax_legend = fig_legend.add_subplot(111)
451 ax_legend.axis(
"off")
452 ax_legend.legend(handles=[
453 Line2D([0], [0], color=
'black', label=
'AoS', linestyle=LineStyles[
'aos']),
454 Line2D([0], [0], color=
'black', label=
'SoA', linestyle=LineStyles[
'soa'])
455 ], labels=[
'AoS',
'SoA'], loc=
"center", ncol=2, frameon=
False)
456 fig_legend.savefig(f
"{folder_name}/layout_legend.pdf", bbox_inches=
'tight', dpi=300)
457 fig_legend.savefig(f
"{folder_name}/layout_legend.png", bbox_inches=
'tight', dpi=300)
464 print( f
"process folder {folder_name}" )
466 for k, kernel
in enumerate(Kernels):
467 for im, implementation
in enumerate(ImplementationVariant_GPU[kernel]):
468 if '#' in implementation:
continue
473 mpl.rcParams.update(params)
475 cell_size_legend_handles = []
476 cell_size_legend_labels = []
477 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
478 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[cs], color=Colors[cs], label=f
'{int(CELL_SIZE)}', linestyle=
'-')]
479 cell_size_legend_labels += [f
'{int(CELL_SIZE)}']
490 impl_data_soa = impl_data_all[CELL_SIZE][1]
491 plt.plot( impl_data_soa[0],
496 linestyle=LineStyles[
'soa']
499 plt.xlabel(
"Particles")
500 plt.ylabel(
"Time per particle update [t]=s")
502 plt.xscale(
'log', base=10)
503 plt.yscale(
'log', base=10)
505 if 'density' in kernel: plt.ylim(2e-7, 2e-5)
506 if 'drift' in kernel: plt.ylim(7e-8, 4e-6)
509 plt.grid(
True, which=
'both')
511 filename = f
"/{kernel}_gpu_{implementation}_shmem".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
512 filename = f
"{folder_name}/{filename}"
514 if 'gi001' in filename:
515 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
516 elif 'gn003' in filename:
517 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
518 elif 'mi300a' in filename:
521 raise Exception(
"I don't know what CPU I'm working on!")
523 plt.savefig(f
"{filename}.pdf")
524 plt.savefig(f
"{filename}.png")
529 fig_legend = plt.figure(figsize=(10, 1))
530 ax_legend = fig_legend.add_subplot(111)
531 ax_legend.axis(
"off")
532 ax_legend.legend(handles=cell_size_legend_handles, labels=cell_size_legend_labels, loc=
"center", ncol=5, frameon=
False)
533 fig_legend.savefig(f
"{folder_name}/cell_legend.pdf", bbox_inches=
'tight', dpi=300)
534 fig_legend.savefig(f
"{folder_name}/cell_legend.png", bbox_inches=
'tight', dpi=300)
536 fig_legend = plt.figure(figsize=(4, 1))
537 ax_legend = fig_legend.add_subplot(111)
538 ax_legend.axis(
"off")
539 ax_legend.legend(handles=[
540 Line2D([0], [0], color=
'black', label=
'AoS', linestyle=LineStyles[
'aos']),
541 Line2D([0], [0], color=
'black', label=
'SoA', linestyle=LineStyles[
'soa'])
542 ], labels=[
'AoS',
'SoA'], loc=
"center", ncol=2, frameon=
False)
543 fig_legend.savefig(f
"{folder_name}/layout_legend.pdf", bbox_inches=
'tight', dpi=300)
544 fig_legend.savefig(f
"{folder_name}/layout_legend.png", bbox_inches=
'tight', dpi=300)
552 print( f
"process folder {folder_name}" )
554 for k, kernel
in enumerate(Kernels):
555 for im, implementation
in enumerate(ImplementationVariant[kernel]):
556 if '#' in implementation:
continue
558 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
561 mpl.rcParams.update(params)
563 cell_size_legend_handles = []
564 cell_size_legend_labels = []
565 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
566 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[cs], color=Colors[cs], label=f
'{int(CELL_SIZE)}', linestyle=
'-')]
567 cell_size_legend_labels += [f
'{int(CELL_SIZE)}']
569 impl_data_aos = impl_data_all[CELL_SIZE][0]
571 impl_data_soa = impl_data_all[CELL_SIZE][1]
573 x_data = impl_data_aos[0]
574 y_data = np.array(impl_data_aos[1]) / np.array(impl_data_soa[1])
585 plt.xlabel(
"Particles")
586 plt.ylabel(
"Relative speedup")
588 plt.xscale(
'log', base=10)
589 if 'density' in kernel
or 'drift' in kernel: plt.ylim(0.1, 3)
592 plt.grid(
True, which=
'both')
594 filename = f
"/{kernel}_{implementation}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
595 filename = f
"{folder_name}/{filename}-relative"
597 if 'gi001' in filename:
598 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
599 elif 'gn003' in filename:
600 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
602 raise Exception(
"I don't know what CPU I'm working on!")
604 plt.axhline(y = 1, color =
'k', linestyle =
'--')
606 plt.savefig(f
"{filename}.pdf")
607 plt.savefig(f
"{filename}.png")
617 print( f
"process folder {folder_name}" )
619 for k, kernel
in enumerate(Kernels):
620 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
621 cell_size_legend_handles = []
622 cell_size_legend_labels = []
625 mpl.rcParams.update(params)
627 for im, implementation
in enumerate(ImplementationVariant_FixedPPC[kernel]):
628 if '#' in implementation:
continue
630 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
632 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[im], color=Colors[im], linestyle=LineStyles[
'aos'])]
633 cell_size_legend_labels += [f
'{ImplementationVariantName[implementation]}']
635 impl_data_aos = impl_data_all[CELL_SIZE][0]
637 x_data = impl_data_aos[0]
638 y_data = impl_data_aos[1]
645 linestyle=LineStyles[
'aos']
648 plt.xlabel(
"Particles")
649 plt.ylabel(
"Time per particle update [t]=s")
651 plt.xscale(
'log', base=10)
653 if 'drift' in kernel:
654 plt.ylim(5e-10, 5e-7)
655 plt.yscale(
'log', base=10)
657 if 'density' in kernel
and int(CELL_SIZE) == 64: plt.ylim(0, 1.3e-6)
658 if 'density' in kernel
and int(CELL_SIZE) == 1024: plt.ylim(0, 2e-5)
661 plt.grid(
True, which=
'both')
663 filename = f
"/{kernel}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
664 filename = f
"{folder_name}/{filename}_cell{CELL_SIZE}_aos"
666 if 'gi001' in filename:
667 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
668 elif 'gn003' in filename:
669 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
671 raise Exception(
"I don't know what CPU I'm working on!")
673 plt.savefig(f
"{filename}.pdf")
674 plt.savefig(f
"{filename}.png")
680 mpl.rcParams.update(params)
682 cell_size_legend_handles = []
683 cell_size_legend_labels = []
685 for im, implementation
in enumerate(ImplementationVariant_FixedPPC[kernel]):
686 if '#' in implementation:
continue
688 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[im], color=Colors[im], linestyle=LineStyles[
'soa'])]
689 cell_size_legend_labels += [f
'{ImplementationVariantName[implementation]}']
691 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
693 impl_data_soa = impl_data_all[CELL_SIZE][1]
695 x_data = impl_data_soa[0]
696 y_data = impl_data_soa[1]
703 linestyle=LineStyles[
'soa']
706 plt.xlabel(
"Particles")
707 plt.ylabel(
"Time per particle update [t]=s")
709 plt.xscale(
'log', base=10)
712 plt.grid(
True, which=
'both')
714 filename = f
"/{kernel}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
715 filename = f
"{folder_name}/{filename}_cell{CELL_SIZE}_soa"
717 if 'gi001' in filename:
718 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
719 elif 'gn003' in filename:
720 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
722 raise Exception(
"I don't know what CPU I'm working on!")
724 plt.savefig(f
"{filename}.pdf")
725 plt.savefig(f
"{filename}.png")
730 fig_legend = plt.figure(figsize=(10, 2))
731 ax_legend = fig_legend.add_subplot(111)
732 ax_legend.axis(
"off")
733 ax_legend.legend(handles=cell_size_legend_handles, labels=cell_size_legend_labels, loc=
"center", ncol=2, frameon=
False)
734 fig_legend.savefig(f
"{folder_name}/{kernel}_variants_legend.pdf", bbox_inches=
'tight', dpi=300)
735 fig_legend.savefig(f
"{folder_name}/{kernel}_variants_legend.png", bbox_inches=
'tight', dpi=300)
747 print( f
"process folder {folder_name}" )
749 for k, kernel
in enumerate(Kernels):
750 for cs, CELL_SIZE
in enumerate(CELL_SIZES):
751 cell_size_legend_handles = []
752 cell_size_legend_labels = []
755 mpl.rcParams.update(params)
757 impl_data_all_baseline =
read_data(folder_name, f
"{kernel} {ImplementationVariant[kernel][0]}")
759 for im, implementation
in enumerate(ImplementationVariant[kernel]):
760 if '#' in implementation:
continue
762 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
764 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[im], color=Colors[im], linestyle=LineStyles[
'aos'])]
765 cell_size_legend_labels += [f
'{implementation}']
767 impl_data_aos_baseline = impl_data_all_baseline[CELL_SIZE][0]
768 impl_data_aos = impl_data_all[CELL_SIZE][0]
770 x_data = impl_data_aos_baseline[0]
771 y_data = np.array(impl_data_aos_baseline[1]) / np.array(impl_data_aos[1])
779 linestyle=LineStyles[
'aos']
782 plt.xlabel(
"Particles")
783 plt.ylabel(f
"Relative performance")
785 plt.xscale(
'log', base=10)
788 plt.grid(
True, which=
'both')
790 filename = f
"/{kernel}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
791 filename = f
"{folder_name}/{filename}_cell{CELL_SIZE}_aos_relative"
793 if 'gi001' in filename:
794 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
795 elif 'gn003' in filename:
796 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
798 raise Exception(
"I don't know what CPU I'm working on!")
800 plt.axhline(y = 1, color =
'k', linestyle =
'--')
802 plt.savefig(f
"{filename}.pdf")
803 plt.savefig(f
"{filename}.png")
809 mpl.rcParams.update(params)
811 cell_size_legend_handles = []
812 cell_size_legend_labels = []
814 for im, implementation
in enumerate(ImplementationVariant[kernel]):
815 if '#' in implementation:
continue
817 cell_size_legend_handles += [Line2D([0], [0], marker=Symbols[im], color=Colors[im], linestyle=LineStyles[
'soa'])]
818 cell_size_legend_labels += [f
'{implementation}']
820 impl_data_all =
read_data(folder_name, f
"{kernel} {implementation}")
822 impl_data_soa_baseline = impl_data_all_baseline[CELL_SIZE][1]
823 impl_data_soa = impl_data_all[CELL_SIZE][1]
825 x_data = impl_data_soa_baseline[0]
826 y_data = np.array(impl_data_soa_baseline[1]) / np.array(impl_data_soa[1])
834 linestyle=LineStyles[
'soa']
837 plt.xlabel(
"Particles")
838 plt.ylabel(f
"Relative performance")
840 plt.xscale(
'log', base=10)
843 plt.grid(
True, which=
'both')
845 filename = f
"/{kernel}".replace(
'(',
'').replace(
')',
'').replace(
',',
'_').replace(
'-',
'_')
846 filename = f
"{folder_name}/{filename}_cell{CELL_SIZE}_soa_relative"
848 if 'gi001' in filename:
849 plt.axvline(x = L2CacheSizeMap[
'gi001']/ParticleSize, color =
'k', linestyle =
'--')
850 elif 'gn003' in filename:
851 plt.axvline(x = L2CacheSizeMap[
'gn003']/ParticleSize, color =
'k', linestyle =
'--')
853 raise Exception(
"I don't know what CPU I'm working on!")
855 plt.axhline(y = 1, color =
'k', linestyle =
'--')
857 plt.savefig(f
"{filename}.pdf")
858 plt.savefig(f
"{filename}.png")
read_data_gpu(folder_name, kernel_name)
returns { 'cell size' : [ (xdata, ydata) for aos - always empty, (xdata, ydata) for soa ],...
read_data_gpu_shmem(folder_name, kernel_name)
returns { 'cell size' : [ (xdata, ydata) for aos - always empty, (xdata, ydata) for soa ],...