HP-MPI User's Guide (11th Edition)
Example applications
multi_par.f
Appendix A 251
multi_par.f
The Alternating Direction Iterative (ADI) method is often used to solve
differential equations. In this example, multi_par.f, a compiler that
supports OPENMP directives is required in order to achieve multi-level
parallelism.
multi_par.f implements the following logic for a 2-dimensional compute
region:
DO J=1,JMAX
DO I=2,IMAX
A(I,J)=A(I,J)+A(I-1,J)
ENDDO
ENDDO
DO J=2,JMAX
DO I=1,IMAX
A(I,J)=A(I,J)+A(I,J-1)
ENDDO
ENDDO
There are loop carried dependencies on the first dimension (array's row)
in the first innermost DO loop and the second dimension (array's
column) in the second outermost DO loop.
A simple method for parallelizing the fist outer-loop implies a
partitioning of the array in column blocks, while another for the second
outer-loop implies a partitioning of the array in row blocks.
With message-passing programming, such a method will require massive
data exchange among processes because of the partitioning change.
"Twisted data layout" partitioning is better in this case because the