I have a Fortran code. Code contains two loops. I want to parallelize ONLY inner loop. Here is my code:
!$OMP PARALLEL PRIVATE(i,j) do i=1, N !$OMP PARALLEL DO do j=1, M ! do some calculations end do !$OMP END PARALLEL DO end do !$OMP END PARALLEL Is parallelization correct? I am not sure, whether it is needed to put !$OMP PARALLEL PRIVATE(i,j) at the beginning? Should I omit it and declare just PRIVATE(i) before the second loop? Anyways, I am a little bit confused, please explain what is correct behaviour.