title: OpenMP C++ Matrix Multiplication run slower in parallel
body: <p>I'm learning the basics of paralel execution of for loop using OpenMP.</p>
  
  <p>Sadly, my paralel program runs 10x slower than serial version.
  What am I doing wrong? Am I missing some barriers?</p>
  
  <pre><code>double **basicMultiply(double **A, double **B, int size) {
     int i, j, k;
     double **res = createMatrix(size);
     omp_set_num_threads(4);
     #pragma omp parallel for private(k)
     for (i = 0; i &lt; size; i++) {
        for (j = 0; j &lt; size; j++) {
           for (k = 0; k &lt; size; k++) {
              res[i][j] += A[i][k] * B[k][j];
           }
        }
     }
     return res;
  }
  </code></pre>
  
  <p>Thank you very much!</p>