commit 4d9a93e3a40b568021b0c671ca2fbc5f300616ea
parent 1bca720ff30609c885d1e15cb1049ab0d03267a8
Author: David Freifeld <freifeld.david@gmail.com>
Date: Tue, 30 Jun 2020 20:59:36 -0700
A little more benchmarking + Eigen fix
Diffstat:
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/bpnn.hpp b/bpnn.hpp
@@ -1,7 +1,7 @@
#ifndef BPNN_H
#define BPNN_H
-#include "/Users/davidfreifeld/Downloads/eigen-3.3.7/Eigen/Dense"
+#include <Eigen/Dense>
#include "../mapreduce/mapreduce.hpp"
diff --git a/example.py b/example.py
@@ -16,29 +16,28 @@ def bench(batch_sz, layers):
end = time.time()
return (end-init)
-timesum=0
-trials = 20
-for i in range(trials):
- timesum+=bench(10,1)
-print("Averages over %s trials\n--------------\nTime: %s seconds.\n" % (trials, timesum/trials))
-# x = []
-# y = []
-# i = 1
-# while(i < 1340):
-# y.append(bench(i, 1))
-# x.append(i)
-# i+=1
-# print(y)
-# plt.plot(x,y, label = "ML-in-Parallel (Sequential)")
-# i = 20
-# otherlist = [1, 5, 10, 15]
-# while(i < 1340):
-# otherlist.append(i)
-# i += 20
-
-# plt.plot(otherlist, [38.563481092453, 8.210114002227783, 4.5140931606292725, 3.3074569702148438, 2.3994078636169434, 1.2735769748687744, 1.0030598640441895, 0.8972160816192627, 0.801548957824707, 0.752018928527832, 0.7073678970336914, 0.6857280731201172, 0.6707980632781982, 0.6421489715576172, 0.6614980697631836, 0.6403779983520508, 0.7251319885253906, 0.6796879768371582, 0.6601080894470215, 0.6711599826812744, 0.6432759761810303, 0.6491389274597168, 0.6762490272521973, 0.6859049797058105, 0.7067179679870605, 0.7142889499664307, 0.7258059978485107, 0.7868969440460205, 0.7326970100402832, 0.7365641593933105, 0.7576079368591309, 0.7772500514984131, 0.8062641620635986, 0.7768490314483643, 0.8253629207611084, 0.8264601230621338, 0.8459320068359375, 0.9670729637145996, 0.8388969898223877, 0.9129719734191895, 0.9009649753570557, 0.8916170597076416, 0.8926799297332764, 0.9171609878540039, 0.9242072105407715, 0.9534740447998047, 0.947465181350708, 0.9723358154296875, 1.018247127532959, 1.1208629608154297, 1.014026165008545, 1.034980058670044, 1.0626468658447266, 1.080394983291626, 1.0627479553222656, 1.0839190483093262, 1.0938241481781006, 1.127730131149292, 1.1265759468078613, 1.136888027191162, 1.140428066253662, 1.1712510585784912, 1.206390142440796, 1.2087180614471436, 1.4066569805145264, 1.2425589561462402, 1.280066967010498, 1.2891559600830078, 1.3243582248687744, 1.3152379989624023], label="Keras")
-# plt.legend()
-# plt.show()
+# timesum=0
+# trials = 20
+# for i in range(trials):
+# timesum+=bench(10,1)
+# print("Averages over %s trials\n--------------\nTime: %s seconds.\n" % (trials, timesum/trials))
+x = []
+y = []
+i = 1
+while(i < 1340):
+ y.append(bench(i, 1))
+ x.append(i)
+ i+=1
+plt.plot(x,y, label = "Jacobian (Sequential)")
+i = 20
+otherlist = []
+while(i < 1340):
+ otherlist.append(i)
+ i += 20
+
+plt.plot(otherlist, [2.3994078636169434, 1.2735769748687744, 1.0030598640441895, 0.8972160816192627, 0.801548957824707, 0.752018928527832, 0.7073678970336914, 0.6857280731201172, 0.6707980632781982, 0.6421489715576172, 0.6614980697631836, 0.6403779983520508, 0.7251319885253906, 0.6796879768371582, 0.6601080894470215, 0.6711599826812744, 0.6432759761810303, 0.6491389274597168, 0.6762490272521973, 0.6859049797058105, 0.7067179679870605, 0.7142889499664307, 0.7258059978485107, 0.7868969440460205, 0.7326970100402832, 0.7365641593933105, 0.7576079368591309, 0.7772500514984131, 0.8062641620635986, 0.7768490314483643, 0.8253629207611084, 0.8264601230621338, 0.8459320068359375, 0.9670729637145996, 0.8388969898223877, 0.9129719734191895, 0.9009649753570557, 0.8916170597076416, 0.8926799297332764, 0.9171609878540039, 0.9242072105407715, 0.9534740447998047, 0.947465181350708, 0.9723358154296875, 1.018247127532959, 1.1208629608154297, 1.014026165008545, 1.034980058670044, 1.0626468658447266, 1.080394983291626, 1.0627479553222656, 1.0839190483093262, 1.0938241481781006, 1.127730131149292, 1.1265759468078613, 1.136888027191162, 1.140428066253662, 1.1712510585784912, 1.206390142440796, 1.2087180614471436, 1.4066569805145264, 1.2425589561462402, 1.280066967010498, 1.2891559600830078, 1.3243582248687744, 1.3152379989624023], label="Keras")
+plt.legend()
+plt.show()
# # sum = 0
# # for i in range(10):