title: Need help resolving data contention in parallel construction of Eigen arrays
body: <p>I have just run a concurrency profiler on my program and have found a line of code that is frequently contended between threads in memory, namely;</p>
  
  <pre><code>// declarations shown here to clarify type:
  size_t const timeSteps;
  typedef Eigen::Array&lt;float, Eigen::Dynamic, Eigen::Dynamic&gt; Signal2D;
  Signal2D Activations(timeSteps, desc.length()); // this line is contended
  </code></pre>
  
  <p>Note that I have declared <code>#define EIGEN_DONT_PARALLELIZE</code> to avoid implicit parallelization of Eigen operations.</p>
  
  <p>The above line is executed concurrently over several threads, but the <code>desc</code> instance is a class that is local to the thread. So why is this piece of code being contended between threads?</p>
  
  <p>In the VS2013 profiler, it says that the specific code being contended is <code>Eigen::DenseStorage&lt;float,-1,-1,-1,0&gt;::resize</code>. Why is this occuring? Is Eigen somehow keeping track of which arrays are created and destroyed between threads? Why? And how do I switch it off?</p>