From f0ac93a60a1ccf65eec571a40a40644e4c0ba7eb Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Tue, 16 May 2017 11:47:15 -0700 Subject: [PATCH] parallelize figure generation --- Makefile | 12 +++- figures/cpu_matvec.pdf | Bin 12063 -> 12063 bytes figures/cpu_matvec.py | 26 +++++++++ figures/kernels.pdf | Bin 13466 -> 13466 bytes figures/kernels.py | 49 +++++++++++++++++ figures/mlfmm.pdf | Bin 18027 -> 18027 bytes figures/mlfmm.py | 71 ++++++++++++++++++++++++ figures/mlfmm_bw.pdf | Bin 16277 -> 16277 bytes figures/mlfmm_minsky.pdf | Bin 15684 -> 15684 bytes figures/plots.py | 116 --------------------------------------- 10 files changed, 157 insertions(+), 117 deletions(-) create mode 100644 figures/cpu_matvec.py create mode 100644 figures/kernels.py create mode 100644 figures/mlfmm.py diff --git a/Makefile b/Makefile index 06a7cf4..372c1de 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,11 @@ all: pdf # $(TEX) -shell-escape $< # $(BIBTEX) $(PROJ) # $(TEX) -shell-escape $< -pdf: $(TEXFILE) + +figures/%.pdf: figures/%.py + $(PYTHON) $< + +pdf: $(TEXFILE) figures/kernels.pdf figures/mlfmm.pdf figures/cpu_matvec.pdf $(PYTHON) figures/plots.py $(TEX) -shell-escape $< $(TEX) -shell-escape $< @@ -29,6 +33,12 @@ clean: $(TEXFILE:.tex=.aux) \ $(TEXFILE:.tex=.log) \ $(TEXFILE:.tex=.toc) \ + figures/kernels.pdf \ + figures/kernels.png \ + figures/mlfmm.pdf \ + figures/mlfmm.png \ + figures/cpu_matvec.pdf \ + figures/cpu_matvec.png \ texput.log \ main.pyg rm -rf \ diff --git a/figures/cpu_matvec.pdf b/figures/cpu_matvec.pdf index 89609e49ca9639c0d6d16f1048eb9baf2487b662..0b8a10f89e807a70f59db63e038ff8c7824c9d1d 100644 GIT binary patch delta 37 tcmbOqH$QH}WX;LDH2oR5CQsBHB}h7CQsB1oXn}Uip$i%(!|KXRM)_C^Ioka761j$3`zh1 diff --git a/figures/cpu_matvec.py b/figures/cpu_matvec.py new file mode 100644 index 0000000..7789599 --- /dev/null +++ b/figures/cpu_matvec.py @@ -0,0 +1,26 @@ +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +import math +sns.set(style="white", context="talk") +plt.rcdefaults() +DPI=300 +BBOX_INCHES='tight' + + +path = 'figures/cpu_matvec' +fig, ax = plt.subplots(figsize=(6, 3)) +systems = ('XE (32T)', "S822LC (160T)") +mlfmm = (8.65e4, 4.84e4) +total = (1.2e5, 5.77e4) +x_pos = np.arange(len(systems)) +ax.bar(x_pos, mlfmm, color='0.4', label='MLFMM') +ax.bar(x_pos, [i-j for i,j in zip(total, mlfmm)], color='0.8', bottom=mlfmm, label='Non-MLFMM') +ax.set_xticks(x_pos) +ax.set_xticklabels(systems) +ax.set_ylabel("Execution Time (ms)") +handles, labels = ax.get_legend_handles_labels() +ax.legend(handles, labels) +sns.despine(trim=True) +plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES) +plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES) diff --git a/figures/kernels.pdf b/figures/kernels.pdf index a0cca022c32dc7f2e9e2ae5e64262eaf7a3fb0d6..9f9d098f11c4ff767a510e755dc60268bc60815c 100644 GIT binary patch delta 37 tcmbQ0IV*F+CB4ai^}HFmCSTCgn(U#!ip$K<(8SEpSl7UO^B?_rEC3*w4ZZ*X delta 37 tcmbQ0IV*F+CB4ZC`WlQ}lP~D`PWI4W#bs(>X<}qxrfXoj`H%iQ761nQ4CDX+ diff --git a/figures/kernels.py b/figures/kernels.py new file mode 100644 index 0000000..ca97c6a --- /dev/null +++ b/figures/kernels.py @@ -0,0 +1,49 @@ +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +import math +sns.set(style="white", context="talk") +plt.rcdefaults() +DPI=300 +BBOX_INCHES='tight' + + +path = 'figures/kernels' +fig, ax = plt.subplots() +systems = ['32T\n(1 XE)', "160T\n(1 S822LC)", "4 GPU\n(4 XK)" ,"4 GPU\n(1 S822LC)"] +x_pos = np.arange(len(systems)) +p2m = (127.10, 72.10749, 7.73, 1.604) +m2m = (156.2506, 102.61091, 9.613814, 1.746476) +m2l = (189.615, 82.67791, 18.177774, 2.671025) +l2l = (91.5957, 101.56461, 20.215436, 2.611185) +l2p = (196.2115, 68.38529, 6.994, 1.395) +p2p = (1117.368, 590.4818, 90.619, 18.265) +total = [sum(i) for i in zip(p2m,m2m,m2l,l2l,l2p,p2p)] +p2m_ratio = [i/j for i,j in zip(p2m, total)] +m2m_ratio = [i/j for i,j in zip(m2m, total)] +m2l_ratio = [i/j for i,j in zip(m2l, total)] +l2l_ratio = [i/j for i,j in zip(l2l, total)] +l2p_ratio = [i/j for i,j in zip(l2p, total)] +p2p_ratio = [i/j for i,j in zip(p2p, total)] +ax.bar(x_pos, p2m_ratio, color='0.75', label='P2M', bottom=[sum(i) for i in zip(m2m_ratio, m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)]) +ax.bar(x_pos, m2m_ratio, color='0.50', label='M2M', bottom=[sum(i) for i in zip(m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)]) +ax.bar(x_pos, m2l_ratio, color='0.40', label='M2L', bottom=[sum(i) for i in zip(l2l_ratio, l2p_ratio,p2p_ratio)]) +ax.bar(x_pos, l2l_ratio, color='0.25', label='L2L', bottom=[sum(i) for i in zip(l2p_ratio,p2p_ratio)]) +ax.bar(x_pos, l2p_ratio, color='0.15', label='L2P', bottom=p2p_ratio) +ax.bar(x_pos, p2p_ratio, color='0', label='P2P') +ax.set_xticks(x_pos) +ax.set_xticklabels(systems) +ax.set_ylabel("MLFMM Kernel Breakdown") +handles, labels = ax.get_legend_handles_labels() +ax.legend(handles, labels) +# plt.ylim([1, 1e4]) +# ax.set_title('How fast do you want to go today?') +sns.despine(trim=True) +legend = plt.legend(frameon = 1) +frame = legend.get_frame() +# frame.set_facecolor('white') +# frame.set_edgecolor('white') +frame.set_alpha(0.9) +plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES) +plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES) + diff --git a/figures/mlfmm.pdf b/figures/mlfmm.pdf index 9fc99f298450207c6c3ad291df0e9b3e057f9088..7c54eac8ddac67f0c04f726710e2476ba3a85ecd 100644 GIT binary patch delta 39 vcmaFe!}z*~alR delta 39 vcmaFe!}z*~alp`nSHp}DSs`Q~sdJ5~T-c?RzQ delta 23 ecmbPQKec{?uN9Z6fu)I&fw``M>E>`NJ5~T-f(GsY diff --git a/figures/mlfmm_minsky.pdf b/figures/mlfmm_minsky.pdf index 5c8d8ca093a2d994e836b69abf913a5f55be758a..764e0b87bf9e16d80d6eb79c6bdf3f9bf9d6ec41 100644 GIT binary patch delta 23 ecmX?7b);&8g$0+Hp`nSHp@pu2`DP~zCRPAtRtDMt delta 23 ecmX?7b);&8g$0+Xfu)I&frYMt>1HPjCRPAtUk2F# diff --git a/figures/plots.py b/figures/plots.py index 813fd5a..8dff926 100644 --- a/figures/plots.py +++ b/figures/plots.py @@ -16,67 +16,6 @@ def autolabel(ax, rect): '%d' % int(round(height)), ha='center', va='bottom') -path = 'figures/cpu_matvec' -fig, ax = plt.subplots(figsize=(6, 3)) -systems = ('XE (32T)', "S822LC (160T)") -mlfmm = (8.65e4, 4.84e4) -total = (1.2e5, 5.77e4) -x_pos = np.arange(len(systems)) - -ax.bar(x_pos, mlfmm, color='0.4', label='MLFMM') -ax.bar(x_pos, [i-j for i,j in zip(total, mlfmm)], color='0.8', bottom=mlfmm, label='Non-MLFMM') -ax.set_xticks(x_pos) -ax.set_xticklabels(systems) -ax.set_ylabel("Execution Time (ms)") -handles, labels = ax.get_legend_handles_labels() -ax.legend(handles, labels) -sns.despine(trim=True) -plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES) -plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES) - -print path - - - -path = 'figures/kernels' -fig, ax = plt.subplots() -systems = ['32T\n(1 XE)', "160T\n(1 S822LC)", "4 GPU\n(4 XK)" ,"4 GPU\n(1 S822LC)"] -x_pos = np.arange(len(systems)) -p2m = (127.10, 72.10749, 7.73, 1.604) -m2m = (156.2506, 102.61091, 9.613814, 1.746476) -m2l = (189.615, 82.67791, 18.177774, 2.671025) -l2l = (91.5957, 101.56461, 20.215436, 2.611185) -l2p = (196.2115, 68.38529, 6.994, 1.395) -p2p = (1117.368, 590.4818, 90.619, 18.265) -total = [sum(i) for i in zip(p2m,m2m,m2l,l2l,l2p,p2p)] -p2m_ratio = [i/j for i,j in zip(p2m, total)] -m2m_ratio = [i/j for i,j in zip(m2m, total)] -m2l_ratio = [i/j for i,j in zip(m2l, total)] -l2l_ratio = [i/j for i,j in zip(l2l, total)] -l2p_ratio = [i/j for i,j in zip(l2p, total)] -p2p_ratio = [i/j for i,j in zip(p2p, total)] -ax.bar(x_pos, p2m_ratio, color='0.75', label='P2M', bottom=[sum(i) for i in zip(m2m_ratio, m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)]) -ax.bar(x_pos, m2m_ratio, color='0.50', label='M2M', bottom=[sum(i) for i in zip(m2l_ratio, l2l_ratio, l2p_ratio,p2p_ratio)]) -ax.bar(x_pos, m2l_ratio, color='0.40', label='M2L', bottom=[sum(i) for i in zip(l2l_ratio, l2p_ratio,p2p_ratio)]) -ax.bar(x_pos, l2l_ratio, color='0.25', label='L2L', bottom=[sum(i) for i in zip(l2p_ratio,p2p_ratio)]) -ax.bar(x_pos, l2p_ratio, color='0.15', label='L2P', bottom=p2p_ratio) -ax.bar(x_pos, p2p_ratio, color='0', label='P2P') -ax.set_xticks(x_pos) -ax.set_xticklabels(systems) -ax.set_ylabel("MLFMM Kernel Breakdown") -handles, labels = ax.get_legend_handles_labels() -ax.legend(handles, labels) -# plt.ylim([1, 1e4]) -# ax.set_title('How fast do you want to go today?') -sns.despine(trim=True) -legend = plt.legend(frameon = 1) -frame = legend.get_frame() -# frame.set_facecolor('white') -# frame.set_edgecolor('white') -frame.set_alpha(0.9) -plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES) -plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES) -print path path='figures/mlfmm_bw' width=0.33 @@ -138,58 +77,3 @@ print path -path="figures/mlfmm" -width=0.33 -WALLTIME="0.8" -SPEEDUP="0.5" -fig, axes = plt.subplots(2,1) -ax=axes[0] -ax.set_title("(a)") -systems = ('1T\n(1 XE)', "32T\n(1 XE)", "1 GPU\n(1 XK)" ,"4 GPU\n(4 XK)", "16 GPU\n(16 XK)") -mlfmm = (1.50e6, 8.64e4, 2.783779e4, 7.01e3, 1.89e3) -num = (45,45,45,45,47) -x_pos = np.arange(len(systems)) -rects = ax.bar([p-width/2 for p in x_pos], [i/j for i,j in zip(mlfmm,num)], color=WALLTIME, log=True, width=width) -autolabel(ax, rects[0]) -autolabel(ax, rects[1]) -autolabel(ax, rects[2]) -autolabel(ax, rects[3]) -autolabel(ax, rects[4]) -ax.set_ylim(1,2e5) - -ax2=ax.twinx() -rects = ax2.bar([p+width/2 for p in x_pos], [mlfmm[0] / i for i in mlfmm], color=SPEEDUP, log=True, width=width) -autolabel(ax2, rects[1]) -autolabel(ax2, rects[2]) -autolabel(ax2, rects[3]) -autolabel(ax2, rects[4]) -ax2.set_ylim(1,5e3) -ax.set_xticks(x_pos) -ax.set_xticklabels(systems) -ax=axes[1] -ax.set_title("(b)") -systems = ('1T\n(1 S822LC)', "160T\n(1 S822LC)", "1 GPU\n(1 S822LC)" ,"4 GPU\n(1 S822LC)") -mlfmm = [1.25e6, 4.84e4, 5.22e3, 1.29e3] -num = (44,44,44,44) -x_pos = np.arange(len(systems)) -rects = ax.bar([p-width/2 for p in x_pos], [i/j for i,j in zip(mlfmm,num)], color=WALLTIME, log=True, width=width) -autolabel(ax, rects[0]) -autolabel(ax, rects[1]) -autolabel(ax, rects[2]) -autolabel(ax, rects[3]) -ax.set_ylim(1,2e5) -ax2=ax.twinx() -rects = ax2.bar([p+width/2 for p in x_pos], [mlfmm[0] / i for i in mlfmm], color=SPEEDUP, log=True, width=width) -autolabel(ax2, rects[1]) -autolabel(ax2, rects[2]) -autolabel(ax2, rects[3]) -ax2.set_ylim(1,5e3) -ax.set_xticks(x_pos) -ax.set_xticklabels(systems) -fig.text(-0.01, 0.5, "Per-MLFMM Execution Time (ms)", va='center', rotation='vertical') -fig.text(0.99, 0.5, "Speedup over Sequential", va='center', rotation='vertical') -fig.tight_layout() -plt.savefig(path+'.pdf', bbox_inches=BBOX_INCHES) -plt.savefig(path+'.png', dpi=DPI, bbox_inches=BBOX_INCHES) -print path -