TutorialsTutorials HomeMPI IntroductionIndexBasic Concepts Initialization Data Types Basic Send Basic Receive Broadcast Reduction Example
FullDocument
Related InfoMPI ResourcesIBM DocsProgramming GuideSubroutine Reference |
Basic Receive
Once you've sent a message, you must receive it on another
task.
The
FortranFORTRAN_TYPE:: rbuf INTEGER:: count, source, tag, status(MPI_STATUS_SIZE), ierr CALL MPI_RECV(rbuf, count, MPI_TYPE, source, tag, comm, status, ierr) Cint MPI_Recv( void *rbuf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status )
The arguments that are different from those in
Example: simple send and receiveThis example, pingpong.f90, available in $EXAMPLES/mpi/intro/simple, demonstrates these calls. If we compile and run franklin% ftn -o pingpong pingpong.f90 the output looks like this: franklin% qsun -I -lmppwidth=2 franklin% cd $PBS_O_WORKDIR franklin% aprun -n 2 ./pingpong 0: TASK # 0 sent 0 0: TASK # 0 received 1 1: TASK # 1 sent 1 1: TASK # 1 received 0 |
![]() |
Page last modified: Fri, 07 Mar 2008 21:41:06 GMT Page URL: http://www.nersc.gov/nusers/help/tutorials/mpi/intro/receive.php Web contact: webmaster@nersc.gov Computing questions: consult@nersc.gov Privacy and Security Notice |
![]() |