[eigen] Performance degradation with OpenMP

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

somewhere in my code I computed A^T*A (A being 3-by-n) and I recognized a performance degradation of ~20% when compiling with OpenMP.

I attached a simple test program that should be showing the issue.

- Hauke

#include <Eigen/Core>
#include <Bench/BenchTimer.h>

#include <iostream>

using namespace Eigen;

void ata(Matrix3Xf& AtA, const Matrix3Xf& m)
{
  AtA = m.transpose() * m;
}

int main()
{
  Matrix3Xf m = Matrix3Xf::Random(3,5000);

  Matrix3Xf C(3,3);

  BenchTimer timer;
  BENCH(timer, 3, 20, ata(C,m));
  std::cout << "prod  cpu         " << timer.best(CPU_TIMER) << "s)\n";
  std::cout << "prod  real        " << timer.best(REAL_TIMER) << "s)\n";
}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/