mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
- 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.
This commit is contained in:
@@ -1,33 +1,32 @@
|
||||
// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
|
||||
|
||||
// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
|
||||
#include <Eigen/Core>
|
||||
|
||||
using namespace std;
|
||||
USING_PART_OF_NAMESPACE_EIGEN
|
||||
|
||||
#ifndef MATTYPE
|
||||
#define MATTYPE MatrixXd
|
||||
#define MATTYPE MatrixXLd
|
||||
#endif
|
||||
|
||||
#ifndef MATSIZE
|
||||
#define MATSIZE 20
|
||||
#define MATSIZE 400
|
||||
#endif
|
||||
|
||||
#ifndef REPEAT
|
||||
#define REPEAT 100000
|
||||
#define REPEAT 100
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
MATTYPE I = MATTYPE::identity(MATSIZE,MATSIZE);
|
||||
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+MATSIZE*j)/MATSIZE;
|
||||
m(i,j) = (i+j+1)/(MATSIZE*MATSIZE);
|
||||
}
|
||||
for(int a = 0; a < REPEAT; a++)
|
||||
{
|
||||
m = I + 0.00005 * (m + m*m);
|
||||
m = I + 0.0001 * (m + m*m);
|
||||
}
|
||||
cout << m(0,0) << endl;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user