aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers
diff options
context:
space:
mode:
authorNunigan <michael.schmid2@ost.ch>2021-08-02 22:49:09 +0200
committerNunigan <michael.schmid2@ost.ch>2021-08-02 22:49:09 +0200
commitf96b0b2b66fe215a9e471eec44c58f4de11c7c0b (patch)
tree177ee97fc17d7cb9103583baefa460060c725026 /buch/papers
parentMerge branch 'master' of https://github.com/AndreasFMueller/SeminarMatrizen (diff)
downloadSeminarMatrizen-f96b0b2b66fe215a9e471eec44c58f4de11c7c0b.tar.gz
SeminarMatrizen-f96b0b2b66fe215a9e471eec44c58f4de11c7c0b.zip
update
Diffstat (limited to '')
-rwxr-xr-xbuch/papers/multiplikation/code/MMbin26848 -> 26848 bytes
-rwxr-xr-xbuch/papers/multiplikation/code/MM.c2
-rw-r--r--buch/papers/multiplikation/code/MM.py23
-rw-r--r--buch/papers/multiplikation/code/c_matrix.h114
-rw-r--r--buch/papers/multiplikation/code/c_meas_4096.pdfbin15865 -> 17400 bytes
-rw-r--r--buch/papers/multiplikation/code/meas/MM.txt20
-rw-r--r--buch/papers/multiplikation/code/meas/MM_dc.txt24
-rw-r--r--buch/papers/multiplikation/code/meas/blas.txt16
-rw-r--r--buch/papers/multiplikation/code/meas/strassen.txt18
-rw-r--r--buch/papers/multiplikation/code/meas/winograd.txt15
-rw-r--r--buch/papers/multiplikation/code/meas_1024.pdfbin17653 -> 18813 bytes
-rw-r--r--buch/papers/multiplikation/code/meas_256.pdfbin19428 -> 17715 bytes
-rw-r--r--buch/papers/multiplikation/code/meas_256.txt10
-rw-r--r--buch/papers/multiplikation/images/c_meas_4096.pdfbin0 -> 15865 bytes
-rw-r--r--buch/papers/multiplikation/images/meas_1024.pdfbin0 -> 18813 bytes
-rwxr-xr-xbuch/papers/multiplikation/loesungsmethoden.tex16
16 files changed, 138 insertions, 120 deletions
diff --git a/buch/papers/multiplikation/code/MM b/buch/papers/multiplikation/code/MM
index f07985f..d52dda4 100755
--- a/buch/papers/multiplikation/code/MM
+++ b/buch/papers/multiplikation/code/MM
Binary files differ
diff --git a/buch/papers/multiplikation/code/MM.c b/buch/papers/multiplikation/code/MM.c
index 04c4dab..a897d4f 100755
--- a/buch/papers/multiplikation/code/MM.c
+++ b/buch/papers/multiplikation/code/MM.c
@@ -31,7 +31,7 @@ int main() {
run_algo(strassen, "strassen",0);
run_algo(MM, "MM", 0);
- // run_algo(winograd, "winograd", 0);
+ run_algo(winograd, "winograd", 0);
run_algo_cblas(0);
return 0;
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
diff --git a/buch/papers/multiplikation/code/c_matrix.h b/buch/papers/multiplikation/code/c_matrix.h
index 13df55d..14389fc 100644
--- a/buch/papers/multiplikation/code/c_matrix.h
+++ b/buch/papers/multiplikation/code/c_matrix.h
@@ -1,97 +1,97 @@
-/* Seminar Matrizen, autogenerated File, Michael Schmid, 30/05/2021, 22:00:57 */
+/* Seminar Matrizen, autogenerated File, Michael Schmid, 02/08/2021, 22:48:43 */
#include <stdint.h>
const int A0[][2] =
{
- {-15,68},
- {49,86}
+ {75,47},
+ {-41,-24}
};
const int B0[][2] =
{
- {33,73},
- {38,-76}
+ {-53,-95},
+ {-93,30}
};
const double dB0[][2] =
{
- {33,73},
- {38,-76}
+ {-53,-95},
+ {-93,30}
};
const double dA0[][2] =
{
- {-15,68},
- {49,86}
+ {75,47},
+ {-41,-24}
};
const int A1[][4] =
{
- {75,-38,-32,-65},
- {37,74,-31,29},
- {15,-62,-20,-20},
- {-31,-35,-89,47}
+ {47,11,-66,8},
+ {36,98,39,82},
+ {-32,12,40,-79},
+ {61,-20,-85,-98}
};
const int B1[][4] =
{
- {71,90,78,-98},
- {4,63,12,-47},
- {11,-44,75,-69},
- {95,-15,64,23}
+ {37,75,-53,9},
+ {37,-33,-67,38},
+ {70,39,-93,43},
+ {43,41,23,-4}
};
const double dB1[][4] =
{
- {71,90,78,-98},
- {4,63,12,-47},
- {11,-44,75,-69},
- {95,-15,64,23}
+ {37,75,-53,9},
+ {37,-33,-67,38},
+ {70,39,-93,43},
+ {43,41,23,-4}
};
const double dA1[][4] =
{
- {75,-38,-32,-65},
- {37,74,-31,29},
- {15,-62,-20,-20},
- {-31,-35,-89,47}
+ {47,11,-66,8},
+ {36,98,39,82},
+ {-32,12,40,-79},
+ {61,-20,-85,-98}
};
const int A2[][8] =
{
- {80,42,3,-16,6,55,87,16},
- {-99,-14,21,-1,-94,-56,91,10},
- {-47,-55,-59,62,12,-53,87,-65},
- {-60,94,-67,23,-62,33,-63,-72},
- {12,-75,16,21,22,-37,1,16},
- {-100,-99,82,-66,2,64,-13,44},
- {59,-100,-90,8,36,-24,18,88},
- {73,-58,75,-100,-19,-29,85,-19}
+ {-54,-87,87,69,52,-21,-86,55},
+ {19,-75,-61,-50,-55,-23,66,-92},
+ {-73,-67,-36,19,84,-11,24,46},
+ {-98,62,-76,57,-100,6,-23,-51},
+ {62,46,1,-64,42,-9,85,-12},
+ {35,-59,-17,-47,78,86,-50,74},
+ {-15,45,33,-59,-9,-81,49,96},
+ {-57,22,-43,7,-30,-45,-5,13}
};
const int B2[][8] =
{
- {-61,88,69,49,-53,47,73,45},
- {16,14,-88,-11,-67,-73,-20,43},
- {-60,-63,26,32,-29,18,-44,-69},
- {1,21,21,38,7,-100,-61,-76},
- {-90,95,-99,88,49,-80,27,-36},
- {24,-12,-47,-7,29,15,52,37},
- {-98,-76,29,76,-41,-75,97,79},
- {62,-90,-35,-14,-30,-42,-95,52}
+ {-71,-82,-80,-78,83,-97,48,-24},
+ {15,75,15,-60,-63,-53,1,-50},
+ {-84,63,67,-2,78,93,-13,95},
+ {61,-26,-88,56,56,27,26,1},
+ {2,54,21,36,9,-41,53,53},
+ {85,-11,42,-51,-6,3,27,97},
+ {10,-2,90,-76,-75,0,8,-37},
+ {10,-64,47,-69,66,-50,89,-66}
};
const double dB2[][8] =
{
- {-61,88,69,49,-53,47,73,45},
- {16,14,-88,-11,-67,-73,-20,43},
- {-60,-63,26,32,-29,18,-44,-69},
- {1,21,21,38,7,-100,-61,-76},
- {-90,95,-99,88,49,-80,27,-36},
- {24,-12,-47,-7,29,15,52,37},
- {-98,-76,29,76,-41,-75,97,79},
- {62,-90,-35,-14,-30,-42,-95,52}
+ {-71,-82,-80,-78,83,-97,48,-24},
+ {15,75,15,-60,-63,-53,1,-50},
+ {-84,63,67,-2,78,93,-13,95},
+ {61,-26,-88,56,56,27,26,1},
+ {2,54,21,36,9,-41,53,53},
+ {85,-11,42,-51,-6,3,27,97},
+ {10,-2,90,-76,-75,0,8,-37},
+ {10,-64,47,-69,66,-50,89,-66}
};
const double dA2[][8] =
{
- {80,42,3,-16,6,55,87,16},
- {-99,-14,21,-1,-94,-56,91,10},
- {-47,-55,-59,62,12,-53,87,-65},
- {-60,94,-67,23,-62,33,-63,-72},
- {12,-75,16,21,22,-37,1,16},
- {-100,-99,82,-66,2,64,-13,44},
- {59,-100,-90,8,36,-24,18,88},
- {73,-58,75,-100,-19,-29,85,-19}
+ {-54,-87,87,69,52,-21,-86,55},
+ {19,-75,-61,-50,-55,-23,66,-92},
+ {-73,-67,-36,19,84,-11,24,46},
+ {-98,62,-76,57,-100,6,-23,-51},
+ {62,46,1,-64,42,-9,85,-12},
+ {35,-59,-17,-47,78,86,-50,74},
+ {-15,45,33,-59,-9,-81,49,96},
+ {-57,22,-43,7,-30,-45,-5,13}
};
const int *Ap[3] = {(int*) A0,(int*) A1,(int*) A2};
const int *Bp[3] = {(int*) B0,(int*) B1,(int*) B2};
diff --git a/buch/papers/multiplikation/code/c_meas_4096.pdf b/buch/papers/multiplikation/code/c_meas_4096.pdf
index 547d794..304015a 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 1a0cd5d..13b6312 100644
--- a/buch/papers/multiplikation/code/meas/MM.txt
+++ b/buch/papers/multiplikation/code/meas/MM.txt
@@ -1,12 +1,12 @@
0.000000,2
0.000000,4
-0.000002,8
-0.000011,16
-0.000080,32
-0.000653,64
-0.005397,128
-0.045147,256
-0.487710,512
-3.964180,1024
-128.863544,2048
-996.370209,4096
+0.000001,8
+0.000010,16
+0.000081,32
+0.000654,64
+0.005556,128
+0.054253,256
+0.487317,512
+4.162845,1024
+125.909034,2048
+1111.312696,4096
diff --git a/buch/papers/multiplikation/code/meas/MM_dc.txt b/buch/papers/multiplikation/code/meas/MM_dc.txt
index 0d5580a..f6be928 100644
--- a/buch/papers/multiplikation/code/meas/MM_dc.txt
+++ b/buch/papers/multiplikation/code/meas/MM_dc.txt
@@ -1,12 +1,12 @@
-0.000006,2
-0.000007,4
-0.000035,8
-0.000228,16
-0.001310,32
-0.007204,64
-0.034338,128
-0.267511,256
-2.131212,512
-17.177403,1024
-146.112874,2048
-1156.777565,4096
+0.000003,2
+0.000002,4
+0.000010,8
+0.000068,16
+0.000594,32
+0.004264,64
+0.036289,128
+0.324645,256
+2.612010,512
+19.928951,1024
+159.333884,2048
+1147.106865,4096
diff --git a/buch/papers/multiplikation/code/meas/blas.txt b/buch/papers/multiplikation/code/meas/blas.txt
index 6b7cd0b..c3ec7ec 100644
--- a/buch/papers/multiplikation/code/meas/blas.txt
+++ b/buch/papers/multiplikation/code/meas/blas.txt
@@ -2,11 +2,11 @@
0.000000,4
0.000001,8
0.000003,16
-0.000021,32
-0.000164,64
-0.001240,128
-0.009657,256
-0.072523,512
-0.735149,1024
-6.895747,2048
-56.812183,4096
+0.000022,32
+0.000179,64
+0.001278,128
+0.010165,256
+0.074739,512
+0.704748,1024
+6.845095,2048
+55.845038,4096
diff --git a/buch/papers/multiplikation/code/meas/strassen.txt b/buch/papers/multiplikation/code/meas/strassen.txt
index 89cf41a..69ea472 100644
--- a/buch/papers/multiplikation/code/meas/strassen.txt
+++ b/buch/papers/multiplikation/code/meas/strassen.txt
@@ -1,12 +1,12 @@
0.000000,2
0.000003,4
0.000010,8
-0.000086,16
-0.000476,32
-0.003366,64
-0.025547,128
-0.184593,256
-1.248713,512
-9.007700,1024
-61.079879,2048
-424.493037,4096
+0.000066,16
+0.000470,32
+0.003368,64
+0.024232,128
+0.172000,256
+1.209262,512
+8.457472,1024
+59.267256,2048
+414.648901,4096
diff --git a/buch/papers/multiplikation/code/meas/winograd.txt b/buch/papers/multiplikation/code/meas/winograd.txt
index 3a4d88b..6e6208a 100644
--- a/buch/papers/multiplikation/code/meas/winograd.txt
+++ b/buch/papers/multiplikation/code/meas/winograd.txt
@@ -2,10 +2,11 @@
0.000001,4
0.000002,8
0.000011,16
-0.000091,32
-0.000663,64
-0.005182,128
-0.046038,256
-0.533429,512
-4.257458,1024
-130.378038,2048
+0.000100,32
+0.000654,64
+0.005229,128
+0.057440,256
+0.517850,512
+4.539413,1024
+130.627663,2048
+1179.261048,4096
diff --git a/buch/papers/multiplikation/code/meas_1024.pdf b/buch/papers/multiplikation/code/meas_1024.pdf
index 7b7a133..70c7ec1 100644
--- a/buch/papers/multiplikation/code/meas_1024.pdf
+++ b/buch/papers/multiplikation/code/meas_1024.pdf
Binary files differ
diff --git a/buch/papers/multiplikation/code/meas_256.pdf b/buch/papers/multiplikation/code/meas_256.pdf
index 4ca7102..2eb177b 100644
--- a/buch/papers/multiplikation/code/meas_256.pdf
+++ b/buch/papers/multiplikation/code/meas_256.pdf
Binary files differ
diff --git a/buch/papers/multiplikation/code/meas_256.txt b/buch/papers/multiplikation/code/meas_256.txt
index 2ca4447..62e77cb 100644
--- a/buch/papers/multiplikation/code/meas_256.txt
+++ b/buch/papers/multiplikation/code/meas_256.txt
@@ -1,6 +1,6 @@
2.000000000000000000e+00 4.000000000000000000e+00 8.000000000000000000e+00 1.600000000000000000e+01 3.200000000000000000e+01 6.400000000000000000e+01 1.280000000000000000e+02 2.560000000000000000e+02
-1.096725463867187500e-05 5.531311035156250000e-05 3.712177276611328125e-04 2.662897109985351562e-03 2.111244201660156250e-02 1.660463809967041016e-01 1.280746459960937500e+00 1.149287748336791992e+01
-5.483627319335937500e-06 5.745887756347656250e-05 4.055500030517578125e-04 3.203868865966796875e-03 2.503871917724609375e-02 2.148163318634033203e-01 1.655935287475585938e+00 1.472915720939636230e+01
-1.335144042968750000e-05 1.153945922851562500e-04 6.134510040283203125e-04 3.850460052490234375e-03 2.817606925964355469e-02 1.827111244201660156e-01 1.277473211288452148e+00 9.337273359298706055e+00
-1.907348632812500000e-05 9.274482727050781250e-05 3.526210784912109375e-04 2.403974533081054688e-03 1.725149154663085938e-02 1.314754486083984375e-01 1.121860027313232422e+00 8.884316682815551758e+00
-3.147125244140625000e-05 6.675720214843750000e-06 4.768371582031250000e-06 7.867813110351562500e-06 2.574920654296875000e-05 5.888938903808593750e-05 2.071857452392578125e-04 6.518363952636718750e-04
+1.144409179687500000e-05 5.507469177246093750e-05 3.774166107177734375e-04 3.177404403686523438e-03 2.508044242858886719e-02 2.120554447174072266e-01 1.431464910507202148e+00 1.076412820816040039e+01
+5.722045898437500000e-06 5.745887756347656250e-05 4.494190216064453125e-04 3.611087799072265625e-03 3.317713737487792969e-02 2.292332649230957031e-01 2.090558290481567383e+00 1.306217479705810547e+01
+1.788139343261718750e-05 1.168251037597656250e-04 5.981922149658203125e-04 4.416465759277343750e-03 3.002405166625976562e-02 2.104022502899169922e-01 1.488269329071044922e+00 9.164114713668823242e+00
+1.955032348632812500e-05 7.224082946777343750e-05 3.829002380371093750e-04 2.558946609497070312e-03 2.043128013610839844e-02 1.361320018768310547e-01 1.089214324951171875e+00 8.553364753723144531e+00
+2.384185791015625000e-05 5.245208740234375000e-06 6.437301635742187500e-06 2.455711364746093750e-05 4.148483276367187500e-05 8.702278137207031250e-05 3.793239593505859375e-04 6.709098815917968750e-04
diff --git a/buch/papers/multiplikation/images/c_meas_4096.pdf b/buch/papers/multiplikation/images/c_meas_4096.pdf
new file mode 100644
index 0000000..547d794
--- /dev/null
+++ b/buch/papers/multiplikation/images/c_meas_4096.pdf
Binary files differ
diff --git a/buch/papers/multiplikation/images/meas_1024.pdf b/buch/papers/multiplikation/images/meas_1024.pdf
new file mode 100644
index 0000000..70c7ec1
--- /dev/null
+++ b/buch/papers/multiplikation/images/meas_1024.pdf
Binary files differ
diff --git a/buch/papers/multiplikation/loesungsmethoden.tex b/buch/papers/multiplikation/loesungsmethoden.tex
index b25462a..8a95dd5 100755
--- a/buch/papers/multiplikation/loesungsmethoden.tex
+++ b/buch/papers/multiplikation/loesungsmethoden.tex
@@ -362,6 +362,22 @@ Folgende Algorithmen wurden jweiles in \texttt{C} und \texttt{Python} implementi
\item \texttt{Numpy} Matrizenmultiplikation in \texttt{Python}
\end{itemize}
+
+\begin{figure}
+ \center
+ \includegraphics[width=\linewidth]{papers/multiplikation/images/c_meas_4096}
+ \caption{Messresultate mit der Programmiersprache \texttt{C}}
+ \label{multiplikation:fig:c_meas_4096}
+\end{figure}
+
+
+\begin{figure}
+ \center
+ \includegraphics[width=\linewidth]{papers/multiplikation/images/meas_1024}
+ \caption{Messresultate mit der Programmiersprache \texttt{Python}}
+ \label{multiplikation:fig:c_meas_4096}
+\end{figure}
+
\section{Fazit}
\rhead{Fazit}