title: OpenMP nested loop parallelism
body: <p>I m using OpenMP and I have a problem with wrong results. </p>
  
  <p>Here is the code : </p>
  
  <pre><code>    #pragma omp parallel shared(L,nthreads,chunk) private(tid,i,j){
          tid = omp_get_thread_num();
          if (tid == 0)
          {
              nthreads = omp_get_num_threads();
              printf("Starting matrix multiple example with %d threads\n",nthreads);
              printf("Initializing matrices...\n");
          }
  
          #pragma omp for schedule (static, chunk) 
          for( i=0; i&lt;SIZE_A;i++){
              for( j=0; j&lt;SIZE_B;j++){
                  if(A[i]==B[j]){
                      if(i==0 || j==0)
                          L[i][j]=1;
                      else
                          L[i][j] = L[i-1][j-1] + 1;
                  }
                  // or reset the matching score to 0
                  else
                      L[i][j]=0;
              }
          }
      }
  </code></pre>
  
  <p>What do you think, why I am getting wrond result?
  What should I change? </p>
  
  <p>Thanks a lot!</p>