aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/multiplikation/code/MM.py
diff options
context:
space:
mode:
Diffstat (limited to 'buch/papers/multiplikation/code/MM.py')
-rw-r--r--buch/papers/multiplikation/code/MM.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/buch/papers/multiplikation/code/MM.py b/buch/papers/multiplikation/code/MM.py
index 352771f..ee6f598 100644
--- a/buch/papers/multiplikation/code/MM.py
+++ b/buch/papers/multiplikation/code/MM.py
@@ -174,7 +174,7 @@ def test_perfomance(n):
plt.plot(n, t_mm_strassen, label='Strassen', lw=5)
plt.plot(n, t_wino, label='Winograd', lw=5)
plt.plot(n, t_np, label='NumPy A@B', lw=5)
- plt.xscale('log', base=2)
+ # plt.xscale('log', base=2)
plt.legend()
plt.xlabel("n")
plt.ylabel("time (s)")
@@ -203,6 +203,7 @@ def plot(num):
plt.plot(n, t_np, label='NumPy A@B', lw=5)
plt.legend()
plt.xlabel("n")
+ # plt.yscale('log', base=10)
plt.ylabel("time (s)")
plt.grid(True)
plt.tight_layout()
@@ -213,7 +214,7 @@ def plot(num):
def plot_c_res(ave, num):
MM = np.loadtxt("meas/MM.txt", delimiter=',')
- # winograd = np.loadtxt("meas/winograd.txt", delimiter=',')
+ winograd = np.loadtxt("meas/winograd.txt", delimiter=',')
blas = np.loadtxt("meas/blas.txt", delimiter=',')
MM_dc = np.loadtxt("meas/MM_dc.txt", delimiter=',')
strassen = np.loadtxt("meas/strassen.txt", delimiter=',')
@@ -233,10 +234,10 @@ def plot_c_res(ave, num):
strassen_t = np.mean(strassen_t.reshape(-1,ave),axis=1)
strassen_n = np.mean(strassen_n.reshape(-1,ave),axis=1)
- # winograd_t = winograd[:,0]
- # winograd_n = winograd[:,1]
- # winograd_t = np.mean(winograd_t.reshape(-1,ave),axis=1)
- # winograd_n = np.mean(winograd_n.reshape(-1,ave),axis=1)
+ winograd_t = winograd[:,0]
+ winograd_n = winograd[:,1]
+ winograd_t = np.mean(winograd_t.reshape(-1,ave),axis=1)
+ winograd_n = np.mean(winograd_n.reshape(-1,ave),axis=1)
blas_t = blas[:,0]
blas_n = blas[:,1]
@@ -256,7 +257,7 @@ def plot_c_res(ave, num):
plt.rc('xtick', labelsize=23)
plt.rc('ytick', labelsize=23)
plt.plot(MM_n, MM_t, label='3 For Loops', lw=5)
- # plt.plot(winograd_n, winograd_t, label='Winograd MM', lw=5)
+ plt.plot(winograd_n, winograd_t, label='Winograd MM', lw=5)
plt.plot(blas_n, blas_t, label='Blas', lw=5)
plt.plot(strassen_n, strassen_t, label='Strassen', lw=5)
plt.plot(MM_dc_n, MM_dc_t, label='Divide and Conquer', lw=5)
@@ -276,11 +277,11 @@ def plot_c_res(ave, num):
# test%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if __name__ == '__main__':
- # plot_c_res(1, 4096)
+ plot_c_res(1, 4096)
- # plot(8)
- n = np.logspace(1,8,8,base=2,dtype=(np.int))
+ # plot(1024)
+ # n = np.logspace(1,10,10,base=2,dtype=(np.int))
# n = np.arange(1,50,2)
# A = np.random.randint(-10, 6, (5,3))
# B = np.random.randint(-10, 6, (3,5))
@@ -291,7 +292,7 @@ if __name__ == '__main__':
# print(C_test)
# print(np.equal(C, C_test))
- t_np = test_perfomance(n)
+ # t_np = test_perfomance(n)
# C = strassen(A, B)
# C_test = A@B