title: OpenMP multi-threading not working for Eigen library
body: <p>Since my research involves doing large matrix products I am trying to enable OpenMP multi-threading capabilities for Eigen. Unfortunately I haven't had any luck so far. </p>
  
  <p>I use Xcode 7 with the following compiler: <code>gcc --version</code></p>
  
  <pre><code>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 7.0.2 (clang-700.1.81)
  Target: x86_64-apple-darwin15.2.0
  Thread model: posix
  </code></pre>
  
  <p>After that I have configured the number of OpenMP threads I want to use, by setting <code>export OMP_NUM_THREADS=4</code>. Then I compile my program using the following flags: <code>-O3 -fopenmp=libomp -DNDEBUG</code>. However trying to set or print the number of threads used by Eigen always returns <code>1</code>. So it looks like only one thread is used:</p>
  
  <pre><code>#include &lt;Eigen/Dense&gt;
  ...
  Eigen::initParallel();
  Eigen::setNbThreads(4);
  int nthreads = Eigen::nbThreads( );
  std::cout &lt;&lt; "THREADS = " &lt;&lt; nthreads &lt;&lt;std::ends; // returns '1'
  </code></pre>
  
  <p>Anyone has any idea why Eigen is only using one thread? According to the steps on the Eigen website (<a href="http://eigen.tuxfamily.org/dox/TopicMultiThreading.html" rel="nofollow">http://eigen.tuxfamily.org/dox/TopicMultiThreading.html</a>) this should work...?</p>