title: How to avoid fork-join when calling cblas_sgemm in MKL?
body: <p>The code is like this:</p>
  
  <pre><code>for(int i = 0; i &lt; loop_count; i++)
     cblas_sgemm(&lt;paras group A&gt;);
  </code></pre>
  
  <p>When the matrix is not very large, the fork-join cost is very obvious, especially when this is run on MIC. Besides, separate the mission by hand will cause some problem on MIC as <a href="https://stackoverflow.com/questions/19734145/mkl-performance-on-intel-phi">MKL Performance on Intel Phi</a> shows. </p>
  
  <pre><code>  //separate the left and result matrix by hand.
    //not a wise solution on MIC
    #pragma omp parallel
    for(int i = 0; i &lt; loop_count; i++)
      cblas_sgemm(&lt;paras group B&gt;);
  </code></pre>
  
  <p>If there is a technique that I can use code:</p>
  
  <pre><code>  #pragma omp parallel
    for(int i = 0; i &lt; loop_count; i++)
      cblas_sgemm(&lt;paras group A&gt;);
  </code></pre>
  
  <p>where cblas_sgemm uses the threads forked out of the for loop since MKL also uses OpenMP to create threads.</p>
  
  <p>Sincerely, FatRabb1t.</p>