The Fortran 90D/HPF compiler treats Fortran array expressions
as parallel expressions. Each node or processor on the parallel system will
execute its part of the computation (if the array associated with
of the expression is distributed).
Array constructs are internally converted to an equivalent FORALL statement
and then the distributed array is computed with a FORALL statement
that is parallelized by localizing array indices.
For example, the following Fortran 90 array statement is
parallelized and produces the Fortran 77 code shown:
REAL X(16), Y(16)
!F90D$ DISTRIBUTE Y(BLOCK)
!F90D$ DISTRIBUTE X(BLOCK)
Y=X+1
The following code would be generated and run locally on each processor.
call set_bound(x_dist,1,1,16,1,llb,lub)
do i1 = llb, lub
y(i1) = x(i1) + 1
enddo
Note that the call set_bound() is a Fortran 90D/HPF runtime library routine. This routine generates the bounds for the index space of the array residing on the local processor. This routine will be discussed more in the Computation Partitioning Section of Chapter 5. For example, on a four processor system, this call would generate different loop bound depending on the processor the call is made on, and the portion of the array stored on that processor, as shown below:
! Processor 1 ! Processor 3 do i1 = 1, 4 do i1 = 9, 12 y(i1) = x(i1) + 1 y(i1) = x(i1) + 1 enddo enddo ! Processor 2 ! Processor 4 do i1 = 5, 8 do i1 = 13, 16 y(i1) = x(i1) + 1 y(i1) = x(i1) + 1 enddo enddo