title: Speed Up Matrix Multiplication with OpenMP and Block Method: Can I Do Better?
body: <p>This is the code I wrote:</p>
  
  <pre><code>#include &lt;omp.h&gt;
  void matrix_multi(int c[][TSIZE], int a[][TSIZE], int b[][TSIZE])
  {
     int B=8;
  
    int i, j, k,i1,j1,k1;
  #pragma omp parallel for private(i,j,k,i1,j1,k1) schedule(auto) collapse(3)
    for (i=0; i&lt;TSIZE; i+=B)
      for (j=0; j&lt;TSIZE; j+=B)
        for (k=0; k&lt;TSIZE; k+=B)
          for (i1=i;i1&lt;i+B;i1++)
            for (j1=j;j1&lt;j+B;j1++)
              {
                int sum=0;
                for (k1=k;k1&lt;k+B;k1++)
                  {
                    sum+=a[i1][k1]*b[k1][j1];
                  }
                c[i1][j1]+=sum;
              }
  
  }
  </code></pre>
  
  <p>My question is: Can I get a better performance with some further manipulation on three inner loops?</p>