aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/benchmarkXcwise.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-11 14:28:42 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-11 14:28:42 +0000
commitdcebc46cdcd29fa65449c6d3215f30a28ec0a8c8 (patch)
tree1e623df72a481574dc523ef096b4a979ebe1b2a9 /bench/benchmarkXcwise.cpp
parent7bee90a62a0e5fec52a4b8a6f0b1d88c175d63f8 (diff)
- cleaner use of OpenMP (no code duplication anymore)
using a macro and _Pragma. - use OpenMP also in cacheOptimalProduct and in the vectorized paths as well - kill the vector assignment unroller. implement in operator= the logic for assigning a row-vector in a col-vector. - CMakeLists support for building tests/examples with -fopenmp and/or -msse2 - updates in bench/, especially replace identity() by ones() which prevents underflows from perturbing bench results.
Diffstat (limited to 'bench/benchmarkXcwise.cpp')
-rw-r--r--bench/benchmarkXcwise.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/bench/benchmarkXcwise.cpp b/bench/benchmarkXcwise.cpp
new file mode 100644
index 000000000..dd29743cd
--- /dev/null
+++ b/bench/benchmarkXcwise.cpp
@@ -0,0 +1,34 @@
+// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
+
+#include <Eigen/Core>
+
+using namespace std;
+USING_PART_OF_NAMESPACE_EIGEN
+
+#ifndef MATTYPE
+#define MATTYPE MatrixXLd
+#endif
+
+#ifndef MATSIZE
+#define MATSIZE 400
+#endif
+
+#ifndef REPEAT
+#define REPEAT 10000
+#endif
+
+int main(int argc, char *argv[])
+{
+ MATTYPE I = MATTYPE::ones(MATSIZE,MATSIZE);
+ MATTYPE m(MATSIZE,MATSIZE);
+ for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++)
+ {
+ m(i,j) = 0.1 * (i+j+1)/(MATSIZE*MATSIZE);
+ }
+ for(int a = 0; a < REPEAT; a++)
+ {
+ m = I + 0.00005 * (m + m/4);
+ }
+ cout << m(0,0) << endl;
+ return 0;
+}