aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/multiplikation/code
diff options
context:
space:
mode:
authorNunigan <michael.schmid2@ost.ch>2021-08-06 17:37:58 +0200
committerNunigan <michael.schmid2@ost.ch>2021-08-06 17:37:58 +0200
commit872595e81de60c85b18408f8de5a49c535518edc (patch)
tree05f76c1e3a183286b938013b3683b47c7c4a77c2 /buch/papers/multiplikation/code
parentMerge branch 'AndreasFMueller:master' into master (diff)
downloadSeminarMatrizen-872595e81de60c85b18408f8de5a49c535518edc.tar.gz
SeminarMatrizen-872595e81de60c85b18408f8de5a49c535518edc.zip
update multiplikation
Diffstat (limited to '')
-rw-r--r--buch/papers/multiplikation/code/MM.py46
-rw-r--r--buch/papers/multiplikation/code/c_meas_4096.pdfbin17400 -> 17448 bytes
-rw-r--r--buch/papers/multiplikation/code/meas/MM.txt4
-rw-r--r--buch/papers/multiplikation/code/meas/blas.txt2
-rw-r--r--buch/papers/multiplikation/code/meas/strassen.txt2
-rw-r--r--buch/papers/multiplikation/code/meas/winograd.txt2
-rw-r--r--buch/papers/multiplikation/code/meas_1024.pdfbin18813 -> 18813 bytes
7 files changed, 30 insertions, 26 deletions
diff --git a/buch/papers/multiplikation/code/MM.py b/buch/papers/multiplikation/code/MM.py
index 47bd6ab..7220ae1 100644
--- a/buch/papers/multiplikation/code/MM.py
+++ b/buch/papers/multiplikation/code/MM.py
@@ -226,28 +226,28 @@ def plot_c_res(ave, num):
MM_t = MM[:,0]
MM_n = MM[:,1]
- MM_t = np.mean(MM_t.reshape(-1,ave),axis=1)
- MM_n = np.mean(MM_n.reshape(-1,ave),axis=1)
+ # MM_t = np.mean(MM_t.reshape(-1,ave),axis=1)
+ # MM_n = np.mean(MM_n.reshape(-1,ave),axis=1)
MM_dc_t = MM_dc[:,0]
MM_dc_n = MM_dc[:,1]
- MM_dc_t = np.mean(MM_dc_t.reshape(-1,ave),axis=1)
- MM_dc_n = np.mean(MM_dc_n.reshape(-1,ave),axis=1)
+ # MM_dc_t = np.mean(MM_dc_t.reshape(-1,ave),axis=1)
+ # MM_dc_n = np.mean(MM_dc_n.reshape(-1,ave),axis=1)
strassen_t = strassen[:,0]
strassen_n = strassen[:,1]
- strassen_t = np.mean(strassen_t.reshape(-1,ave),axis=1)
- strassen_n = np.mean(strassen_n.reshape(-1,ave),axis=1)
+ # 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 = 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]
- blas_t = np.mean(blas_t.reshape(-1,ave),axis=1)
- blas_n = np.mean(blas_n.reshape(-1,ave),axis=1)
+ # blas_t = np.mean(blas_t.reshape(-1,ave),axis=1)
+ # blas_n = np.mean(blas_n.reshape(-1,ave),axis=1)
def func(x, a,b):
return b*x**a
@@ -261,14 +261,16 @@ def plot_c_res(ave, num):
plt.rc('axes', labelsize=23)
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(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)
+ plt.loglog(MM_n, MM_t, label='3 For Loops', lw=5)
+ plt.loglog(winograd_n, winograd_t, label='Winograd MM', lw=5)
+ plt.loglog(blas_n, blas_t, label='Blas', lw=5)
+ plt.loglog(strassen_n, strassen_t, label='Strassen', lw=5)
+ plt.loglog(MM_dc_n, MM_dc_t, label='Divide and Conquer', lw=5)
plt.xlabel("n")
+ # plt.yscale('log', base=10)
+ # plt.xscale('log', base=2)
plt.ylabel("time (s)")
- plt.grid(True)
+ plt.grid(True, which="both", ls="-")
plt.tight_layout()
plt.legend(fontsize=19)
plt.savefig('c_meas_' + str(num)+ '.pdf')
@@ -278,15 +280,17 @@ def plot_c_res(ave, num):
# plt.plot(blas_n, func(blas_n, *popt2), 'r-', label='fit MM: a=%5.5f, b=%5.10f' % tuple(popt2))
plt.legend()
-
+ # return [MM_n,winograd_n,blas_n,strassen_n,MM_dc_n]
+ return [MM_t,winograd_t,blas_t,strassen_t,MM_dc_t]
+
# test%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if __name__ == '__main__':
- # plot_c_res(1, 4096)
+ # A = plot_c_res(1, 4096)
- # arr = plot(1024)
- n = np.logspace(1,12,12,base=2,dtype=(np.int))
+ arr = plot(1024)
+ # n = np.logspace(1,12,12,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))
@@ -297,7 +301,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
diff --git a/buch/papers/multiplikation/code/c_meas_4096.pdf b/buch/papers/multiplikation/code/c_meas_4096.pdf
index 304015a..5236afb 100644
--- a/buch/papers/multiplikation/code/c_meas_4096.pdf
+++ b/buch/papers/multiplikation/code/c_meas_4096.pdf
Binary files differ
diff --git a/buch/papers/multiplikation/code/meas/MM.txt b/buch/papers/multiplikation/code/meas/MM.txt
index 13b6312..e296dd7 100644
--- a/buch/papers/multiplikation/code/meas/MM.txt
+++ b/buch/papers/multiplikation/code/meas/MM.txt
@@ -1,5 +1,5 @@
-0.000000,2
-0.000000,4
+0.000001,2
+0.000001,4
0.000001,8
0.000010,16
0.000081,32
diff --git a/buch/papers/multiplikation/code/meas/blas.txt b/buch/papers/multiplikation/code/meas/blas.txt
index c3ec7ec..92a61b9 100644
--- a/buch/papers/multiplikation/code/meas/blas.txt
+++ b/buch/papers/multiplikation/code/meas/blas.txt
@@ -1,5 +1,5 @@
0.000001,2
-0.000000,4
+0.000001,4
0.000001,8
0.000003,16
0.000022,32
diff --git a/buch/papers/multiplikation/code/meas/strassen.txt b/buch/papers/multiplikation/code/meas/strassen.txt
index 69ea472..fdfbf2b 100644
--- a/buch/papers/multiplikation/code/meas/strassen.txt
+++ b/buch/papers/multiplikation/code/meas/strassen.txt
@@ -1,4 +1,4 @@
-0.000000,2
+0.000001,2
0.000003,4
0.000010,8
0.000066,16
diff --git a/buch/papers/multiplikation/code/meas/winograd.txt b/buch/papers/multiplikation/code/meas/winograd.txt
index 6e6208a..d185906 100644
--- a/buch/papers/multiplikation/code/meas/winograd.txt
+++ b/buch/papers/multiplikation/code/meas/winograd.txt
@@ -1,4 +1,4 @@
-0.000000,2
+0.000001,2
0.000001,4
0.000002,8
0.000011,16
diff --git a/buch/papers/multiplikation/code/meas_1024.pdf b/buch/papers/multiplikation/code/meas_1024.pdf
index 3312420..f489a7d 100644
--- a/buch/papers/multiplikation/code/meas_1024.pdf
+++ b/buch/papers/multiplikation/code/meas_1024.pdf
Binary files differ