summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arteaga <andyspiros@gmail.com>2012-10-21 15:54:14 +0200
committerAndrea Arteaga <andyspiros@gmail.com>2012-10-21 15:54:14 +0200
commitac9b7077f21d2a3456903bcf93f9c18907f94dba (patch)
treee0b3bb16beaf08c09174b61452f939be35f7ce01
parentUpdated C interface with new (not tested) LAPACKe functions. (diff)
parentUse different seeds. (diff)
downloadauto-numerical-bench-newinterfaces.tar.gz
auto-numerical-bench-newinterfaces.tar.bz2
auto-numerical-bench-newinterfaces.zip
Merge remote branch 'origin/newinterfaces' into newinterfacesnewinterfaces
-rw-r--r--btl/actions/BLAS/action_MatrixMatrix.hpp4
-rw-r--r--btl/actions/BLAS/action_MatrixTMatrix.hpp4
-rw-r--r--btl/actions/BLAS/action_MatrixTVector.hpp4
-rw-r--r--btl/actions/BLAS/action_MatrixVector.hpp4
-rw-r--r--btl/actions/BLAS/action_Rank1Update.hpp4
-rw-r--r--btl/actions/BLAS/action_Rank2Update.hpp4
-rw-r--r--btl/actions/BLAS/action_SymMatrixVector.hpp4
-rw-r--r--btl/actions/BLAS/action_TriMatrixMatrix.hpp4
-rw-r--r--btl/actions/BLAS/action_TriSolveMatrix.hpp4
-rw-r--r--btl/actions/BLAS/action_TriSolveVector.hpp4
-rw-r--r--btl/actions/BLAS/action_axpy.hpp4
-rw-r--r--btl/actions/BLAS/action_rot.hpp4
-rw-r--r--btl/actions/LAPACK/action_Choleskydecomp.hpp4
-rw-r--r--btl/actions/LAPACK/action_GeneralSolve.hpp4
-rw-r--r--btl/actions/LAPACK/action_LUdecomp.hpp4
-rw-r--r--btl/actions/LAPACK/action_LeastSquaresSolve.hpp4
-rw-r--r--btl/actions/LAPACK/action_QRdecomp.hpp9
-rw-r--r--btl/generic_bench/accuracy.hpp20
18 files changed, 49 insertions, 44 deletions
diff --git a/btl/actions/BLAS/action_MatrixMatrix.hpp b/btl/actions/BLAS/action_MatrixMatrix.hpp
index a69a7f0..ef3b54e 100644
--- a/btl/actions/BLAS/action_MatrixMatrix.hpp
+++ b/btl/actions/BLAS/action_MatrixMatrix.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_MatrixMatrix(int size)
- : _size(size), lc(10),
+ Action_MatrixMatrix(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
C(size*size), C_work(size*size)
{
diff --git a/btl/actions/BLAS/action_MatrixTMatrix.hpp b/btl/actions/BLAS/action_MatrixTMatrix.hpp
index 43aaf74..de983ea 100644
--- a/btl/actions/BLAS/action_MatrixTMatrix.hpp
+++ b/btl/actions/BLAS/action_MatrixTMatrix.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_MatrixTMatrix(int size)
- : _size(size), lc(10),
+ Action_MatrixTMatrix(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
C(size*size), C_work(size*size)
{
diff --git a/btl/actions/BLAS/action_MatrixTVector.hpp b/btl/actions/BLAS/action_MatrixTVector.hpp
index 20b360a..d7d4df2 100644
--- a/btl/actions/BLAS/action_MatrixTVector.hpp
+++ b/btl/actions/BLAS/action_MatrixTVector.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_MatrixTVector(int size)
- : _size(size), lc(10),
+ Action_MatrixTVector(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
A_work(size*size), x_work(size), y_work(size)
{
diff --git a/btl/actions/BLAS/action_MatrixVector.hpp b/btl/actions/BLAS/action_MatrixVector.hpp
index b1a37d0..0ed5c3e 100644
--- a/btl/actions/BLAS/action_MatrixVector.hpp
+++ b/btl/actions/BLAS/action_MatrixVector.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_MatrixVector(int size)
- : _size(size), lc(10),
+ Action_MatrixVector(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
y(size), y_work(size)
{
diff --git a/btl/actions/BLAS/action_Rank1Update.hpp b/btl/actions/BLAS/action_Rank1Update.hpp
index bd88ac3..e2ba61a 100644
--- a/btl/actions/BLAS/action_Rank1Update.hpp
+++ b/btl/actions/BLAS/action_Rank1Update.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_Rank1Update(int size)
- : _size(size), lc(10),
+ Action_Rank1Update(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), A_work(size*size),
x(lc.fillVector<Scalar>(size)), y(lc.fillVector<Scalar>(size))
{
diff --git a/btl/actions/BLAS/action_Rank2Update.hpp b/btl/actions/BLAS/action_Rank2Update.hpp
index b0b1693..a94f4b0 100644
--- a/btl/actions/BLAS/action_Rank2Update.hpp
+++ b/btl/actions/BLAS/action_Rank2Update.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_Rank2Update(int size)
- : _size(size), lc(10),
+ Action_Rank2Update(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), A_work(size*size),
x(lc.fillVector<Scalar>(size)), y(lc.fillVector<Scalar>(size))
{
diff --git a/btl/actions/BLAS/action_SymMatrixVector.hpp b/btl/actions/BLAS/action_SymMatrixVector.hpp
index e475007..e4f324e 100644
--- a/btl/actions/BLAS/action_SymMatrixVector.hpp
+++ b/btl/actions/BLAS/action_SymMatrixVector.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_SymMatrixVector(int size)
- : _size(size), lc(10),
+ Action_SymMatrixVector(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
y(size), y_work(size)
{
diff --git a/btl/actions/BLAS/action_TriMatrixMatrix.hpp b/btl/actions/BLAS/action_TriMatrixMatrix.hpp
index 2b8a7c1..2655413 100644
--- a/btl/actions/BLAS/action_TriMatrixMatrix.hpp
+++ b/btl/actions/BLAS/action_TriMatrixMatrix.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_TriMatrixMatrix(int size)
- : _size(size), lc(10),
+ Action_TriMatrixMatrix(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
B_work(size*size)
{
diff --git a/btl/actions/BLAS/action_TriSolveMatrix.hpp b/btl/actions/BLAS/action_TriSolveMatrix.hpp
index f2f8879..0e7ddfc 100644
--- a/btl/actions/BLAS/action_TriSolveMatrix.hpp
+++ b/btl/actions/BLAS/action_TriSolveMatrix.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_TriSolveMatrix(int size)
- : _size(size), lc(10),
+ Action_TriSolveMatrix(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
X_work(size*size)
{
diff --git a/btl/actions/BLAS/action_TriSolveVector.hpp b/btl/actions/BLAS/action_TriSolveVector.hpp
index 6cac6f1..a858c77 100644
--- a/btl/actions/BLAS/action_TriSolveVector.hpp
+++ b/btl/actions/BLAS/action_TriSolveVector.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_TriSolveVector(int size)
- : _size(size), lc(10),
+ Action_TriSolveVector(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), b(lc.fillVector<Scalar>(size)),
x_work(size)
{
diff --git a/btl/actions/BLAS/action_axpy.hpp b/btl/actions/BLAS/action_axpy.hpp
index 85cb40e..2cc8324 100644
--- a/btl/actions/BLAS/action_axpy.hpp
+++ b/btl/actions/BLAS/action_axpy.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_axpy(int size)
- : _size(size), lc(10),
+ Action_axpy(int size, int seed=10)
+ : _size(size), lc(seed),
x(lc.fillVector<Scalar>(size)),
x_work(size), y_work(size)
{
diff --git a/btl/actions/BLAS/action_rot.hpp b/btl/actions/BLAS/action_rot.hpp
index 574254a..5eca8ba 100644
--- a/btl/actions/BLAS/action_rot.hpp
+++ b/btl/actions/BLAS/action_rot.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_rot(int size)
- : _size(size), lc(10),
+ Action_rot(int size, int seed=10)
+ : _size(size), lc(seed),
x(lc.fillVector<Scalar>(size)), y(lc.fillVector<Scalar>(size)),
x_work(size), y_work(size)
{
diff --git a/btl/actions/LAPACK/action_Choleskydecomp.hpp b/btl/actions/LAPACK/action_Choleskydecomp.hpp
index b60bac1..ae0a6b0 100644
--- a/btl/actions/LAPACK/action_Choleskydecomp.hpp
+++ b/btl/actions/LAPACK/action_Choleskydecomp.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_Choleskydecomp(int size)
- : _size(size), lc(10),
+ Action_Choleskydecomp(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), A_work(size*size)
{
MESSAGE("Action_Choleskydecomp Constructor");
diff --git a/btl/actions/LAPACK/action_GeneralSolve.hpp b/btl/actions/LAPACK/action_GeneralSolve.hpp
index c6842b1..b547d82 100644
--- a/btl/actions/LAPACK/action_GeneralSolve.hpp
+++ b/btl/actions/LAPACK/action_GeneralSolve.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_GeneralSolve(int size)
- : _size(size), lc(10),
+ Action_GeneralSolve(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), b(lc.fillVector<Scalar>(size)),
A_work(size*size), x_work(size), b_res(size), ipiv(size)
{
diff --git a/btl/actions/LAPACK/action_LUdecomp.hpp b/btl/actions/LAPACK/action_LUdecomp.hpp
index 1369017..f1e66c2 100644
--- a/btl/actions/LAPACK/action_LUdecomp.hpp
+++ b/btl/actions/LAPACK/action_LUdecomp.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_LUdecomp(int size)
- : _size(size), lc(10),
+ Action_LUdecomp(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), A_work(size*size),
eye_work(size*size), ipiv(size)
{
diff --git a/btl/actions/LAPACK/action_LeastSquaresSolve.hpp b/btl/actions/LAPACK/action_LeastSquaresSolve.hpp
index 4bd7da4..f25c39d 100644
--- a/btl/actions/LAPACK/action_LeastSquaresSolve.hpp
+++ b/btl/actions/LAPACK/action_LeastSquaresSolve.hpp
@@ -35,8 +35,8 @@ private:
public:
// Constructor
- Action_LeastSquaresSolve(int size)
- : _size(size), lc(10),
+ Action_LeastSquaresSolve(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), b(lc.fillVector<Scalar>(size)),
A_work(size*size), x_work(size), b_res(size)
{
diff --git a/btl/actions/LAPACK/action_QRdecomp.hpp b/btl/actions/LAPACK/action_QRdecomp.hpp
index a079407..c367f5e 100644
--- a/btl/actions/LAPACK/action_QRdecomp.hpp
+++ b/btl/actions/LAPACK/action_QRdecomp.hpp
@@ -35,10 +35,11 @@ private:
public:
// Constructor
- Action_QRdecomp(int size)
- : _size(size), lc(10),
+ Action_QRdecomp(int size, int seed=10)
+ : _size(size), lc(seed),
A(lc.fillVector<Scalar>(size*size)), A_work(size*size),
- tau_work(size), jpiv(size, 0), jpiv_work(size)
+ tau_work(size), jpiv(size, 0), jpiv_work(size),
+ Q_work(size*size), H_work(size*size), v_work(size), eye_work(size*size)
{
MESSAGE("Action_QRdecomp Constructor");
}
@@ -72,7 +73,7 @@ private:
LinearCongruential<> lc;
const vector_t A;
- vector_t A_work, tau_work;
+ vector_t A_work, tau_work, Q_work, H_work, v_work, eye_work;
std::vector<int> jpiv, jpiv_work;
};
diff --git a/btl/generic_bench/accuracy.hpp b/btl/generic_bench/accuracy.hpp
index eb3265f..eb26990 100644
--- a/btl/generic_bench/accuracy.hpp
+++ b/btl/generic_bench/accuracy.hpp
@@ -46,11 +46,10 @@ void bench_accuracy (int size_min, int size_max, int nb_point,
// Loop on sizes
for (int i = nb_point-1; i >= 0; --i) {
- if (!silent)
- std::cout << " " << "size = " << sizes[i] << ", " << std::flush;
+ const int size = sizes[i];
- // Initialize action with given size
- Action action(sizes[i]);
+ if (!silent)
+ std::cout << " " << "size = " << size << ", " << std::flush;
int repetitions = 0;
double average = 0., stddev = 0., e;
@@ -58,17 +57,20 @@ void bench_accuracy (int size_min, int size_max, int nb_point,
// Perform time loop and store average and standard deviation
timer.start();
do {
+ // Initialize action with given size and new seed
+ Action action(size, 15+repetitions);
e = action.getResidual();
average += e;
stddev += e*e;
++repetitions;
- } while(timer.elapsed() < 1.);
+ } while(timer.elapsed() < 1. || repetitions < 4);
// Compute average and standard deviation
+ // (sometimes strange things happen)
average /= repetitions;
- stddev = std::sqrt(stddev/repetitions - average*average);
+ stddev = std::sqrt(std::fabs(stddev/repetitions - average*average));
errors[i] = average;
devs[i] = stddev;
@@ -76,15 +78,17 @@ void bench_accuracy (int size_min, int size_max, int nb_point,
// Output
if (!silent)
std::cout << "average = " << average << ", stddev = " << stddev
- << std::endl;
+ << " (" << repetitions << " samples)" << std::endl;
}
// Dump the result
if (!silent) {
std::ofstream outfile(filename.c_str());
+ // Don't dump the stddev for now
for (int i = 0; i < nb_point; ++i)
- outfile << sizes[i] << " " << errors[i] << " " << devs[i] << "\n";
+ //outfile << sizes[i] << " " << errors[i] << " " << devs[i] << "\n";
+ outfile << sizes[i] << " " << errors[i] << "\n";
outfile.close();