According to the OpenMP reference, Fortran supports reduction with max/min function, which is not supported in C++. Could anyone please explain to me how an OpenMP do loop can use reduction with max/min function?
program max_reduction
implicit none
integer :: a(8),v, i
a = [4,2,3,1,8,6,7,5]
v = a(1)
!$omp parallel do default(none) shared(a) reduction(max: v)
do i = 1, 8
v = max(a(i),v)
end do
!$omp end parallel do
print *, "max(a) = ", v
end program