title: How to maximize cpu usage with Eigen and OpenMP
body: <p>I have a 4-core cpu and I am trying to optimize my code to reduce my calculation time on products of 2000x2000 Eigen matrix. Since I am using OpenMP I was expecting to reach 400% of CPU usage. But, for some reason I am stuck at 200%.</p>
  
  <p>I am using Ubuntu 14.04. My code is written in <code>C++</code>. It uses the <code>Eigen</code> matrix library with <code>OpenMP</code> and the <code>MKL</code>. I compile my code with <code>ICC</code> with the following arguments:
  (this is an extract of my .pro file since I use Qt)</p>
  
  <pre><code>INCLUDEPATH += /opt/intel/mkl/include
  LIBS += -L/opt/intel/mkl/lib/intel64 \
      -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \
      -L/opt/intel/lib/intel64 \
      -liomp5 -lpthread -lm
  DEFINES += NDEBUG
  DEFINES += EIGEN_USE_MKL_ALL
  QMAKE_CXXFLAGS_RELEASE += -fast -march=corei7 -qopenmp -static
  </code></pre>
  
  <p>How can I reach 400% of CPU usage?
  Thanks.</p>
  
  <hr>
  
  <p>PS: EDIT
  What part of my code could be useful?</p>
  
  <pre><code>int nthreads = omp_get_num_threads();
  cout &lt;&lt; endl &lt;&lt; nthreads &lt;&lt; " thread(s) available for computation" &lt;&lt; endl;
  cout &lt;&lt; Eigen::nbThreads() &lt;&lt; " thread(s) used by Eigen" &lt;&lt; endl;
  </code></pre>
  
  <p>this, for instance displays 1 thread available and 4 used by Eigen. Is this normal?</p>