HP-MPI User's Guide (11th Edition)

Example applications
multi_par.f
Appendix A260
implicit none
integer nrow ! # of rows
integer ncol ! # of columns
double precision array(nrow,ncol) ! compute region
integer rbs ! row block start
subscript
integer rbe ! row block end
subscript
integer cbs ! column block start
subscript
integer cbe ! column block end
subscript
c
c Local variables
c
integer i,j
c
c The OPENMP directives below allow the compiler to split
the
c values for "i" between a number of threads, while "j"
moves
c forward lock-step between the threads. By making j
shared
c and i private, all the threads work on the same column
"j" at
c any given time, but they each work on a different
portion "i"
c of that column.
c
c This is not as efficient as found in the compcolumn
subroutine,
c but is necessary due to data dependencies.
c
C$OMP PARALLEL PRIVATE(i)
do j=max(2,cbs),cbe
C$OMP DO
do i=rbs,rbe
array(i,j)=array(i,j-1)+array(i,j)
enddo
C$OMP END DO
enddo
C$OMP END PARALLEL
end
c
c*************************************************************
*********
subroutine getdata(nrow,ncol,array)
c
c Enter dummy data
c