Sergey, TimP-
Thank you for your responses. I will go ahead and post a message on the Intel Fortran board.
Regarding the visible variable declaration, I think I misstated my question. I do understand that the array on which the REDUCTION is performed needs to be declared as shared. I was wondering if the hidden private arrays are initialized to zero or to the visible shared array in the REDUCTION declaration. I would've guessed they are initialized to the shared array values set before the do-loop/reduction. I performed the following test using Intel Fortran 11.1 on a Linux 64-bit machine using 1 thread
! Initialize
a(1,1:10)=1.0d0
a(2,1:5)=1.0d0
a(2,6:10)=2.0d0
!$ nthreads=1
!$ call omp_set_num_threads(nthreads)
!$ omp parallel do private(i) reduction(+:a)
do i=1, 10
a(2,i)=a(2,i)+a(1,i)
end do
!$ omp end parallel do
Compiling the code without the -openmp flag yields the correct result, i.e. a(2,1:5)=2 and a(2,6:10)=3. However, compiling with the -openmp results is a(2,1:5)=1 and a(2,6:10)=2. What seems to happen here is that the private copy of "a", a_priv, is initialized as a_priv(1,1:10)=0.0d0, and a_prive(2,1:10)=a(2,1:10), I think.
Regarding the second question, I took the code shown above and reduced the dimension of a to a(1:10) and added 1.0d0 inside the loop. If I changed the extent of the loop to i=1, 5 then the reduction did in fact only affect elements a(1:5), and left a(6:10) as initialized, resulting in the correct values for a.
I'll go over to Intel Fortran and post a similar message to see what they say.
Feel free to comment, thanks!