Basic HTML version of Foils prepared 2 September 1997

Foil 23 Possible Implementation of MPSHIFT in MPI

From CPS615 Laplace Example -- Programming Models and Performance CPS615 Basic Simulation Track for Computational Science -- Fall Semester 97. 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