Question on OpenMP reduction

@aledinola and @manuel.arenaz
My apologies for misappropriating the !$OMP atomic suggestion.

The use of is_p as the OMP DO variable, provides sufficient seperation to not require atomic.
The selected loops provides insufficient computation to justify !$OMP.
I think this is a good example where targeting SIMD is the best approach.

Perhaps a better change could be (although minimal improvement)

            do is = 1, NS
              do ia = 0, NA
                 la = ial(ia,is)
                 fl =      varphi(ia,is) *phi(ia,is)
                 fr = (1d0-varphi(ia,is))*phi(ia,is)
                   phi_new(la,   : ) = phi_new(la,   : ) +  pi(is, : ) * fl
                   phi_new(la+1, : ) = phi_new(la+1, : ) +  pi(is, : ) * fr
              end do
           end do
2 Likes