From f5741d4277e6921bfc0b3a820d340eb15b6c66e7 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 14 Jan 2009 18:27:17 +0000 Subject: add a sparse * dense_vector bench --- bench/sparse_dense_product.cpp | 198 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 bench/sparse_dense_product.cpp (limited to 'bench/sparse_dense_product.cpp') diff --git a/bench/sparse_dense_product.cpp b/bench/sparse_dense_product.cpp new file mode 100644 index 000000000..3caf8598a --- /dev/null +++ b/bench/sparse_dense_product.cpp @@ -0,0 +1,198 @@ + +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out +// -DNOGMM -DNOMTL -DCSPARSE +// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a +#ifndef SIZE +#define SIZE 10000 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j=MINDENSITY; density*=0.5) + { + fillMatrix(density, rows, cols, sm1); + + // dense matrices + #ifdef DENSEMATRIX + { + std::cout << "Eigen Dense\t" << density*100 << "%\n"; + DenseMatrix m1(rows,cols); + eiToDense(sm1, m1); + + timer.reset(); + timer.start(); + for (int k=0; k gmmV1(cols), gmmV2(cols); + Map >(&gmmV1[0], cols) = v1; + Map >(&gmmV2[0], cols) = v2; + + timer.reset(); + timer.start(); + for (int k=0; k mtlV1(cols, 1.0); + mtl::dense_vector mtlV2(cols, 1.0); + + timer.reset(); + timer.start(); + for (int k=0; k