Basic HTML version of Foils prepared
2 October 1995
Foil 22 Possible Implementation of MPSHIFT in MPI
From
New CPS615 Foils-- D 23 September 95 CPS615 Basic Simulation Track for Computational Science --
Fall Semester 95
.
by
Geoffrey C. Fox
Let PROCNUM be processor "rank" (number or order in
one dimensional decomposition)
IPAR = PROCNUM/2
IF (IPAR.e.q.0)
THEN ! even processors
IF (SOURCE.NE."DUMMY")
CALL MPI_SEND (SOURCE,1,MPI_REAL,PROCNUM+1,tag,comm)
IF (DEST.NE"DUMMY")
CALL MPI_RECV (DEST,1,MPI_REAL, PROCNUM-1,tag,comm,status)
ELSE ! odd processors
IF (DEST.NE."DUMMY")
CALL MPI_RECV (DEST,1,MPI_REAL, PROCNUM-1,tag,comm)
IF (SOURCE.NE."DUMMY")
CALL MPI_SEND (SOURCE,1,MPI_REAL,PROCNUM+1,tag,comm,status)
Note: MPI uses reserved word MPI_PROCNULL rather than "DUMMY". Also, we could remove setting of "DUMMY" in calling routine and placed in MPSHIFT as test on PROCNUM
©
on Tue Oct 7 1997