#include<stdio.h>
#include<mpi.h>
void main (int argc, char **argv)
{
int myrank;
MPI_Status status;
double a[100]; MPI_Init(&argc, &argv); /* Initialize MPI */
MPI_Comm_rank(MPI_COMM_WORLD, &myrank); /* Get rank */
if( myrank == 0 ) /* Send a message */
MPI_Send( a, 100, MPI_DOUBLE, 1, 17, MPI_COMM_WORLD );
else if( myrank == 1 ) /* Receive a message */
MPI_Recv( a, 100, MPI_DOUBLE, 0, 17, MPI_COMM_WORLD, &status );
MPI_Finalize(); /* Terminate MPI */
}
I2luY2x1ZGU8c3RkaW8uaD4KCiNpbmNsdWRlPG1waS5oPgoKdm9pZCBtYWluIChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCgp7CgppbnQgbXlyYW5rOwoKTVBJX1N0YXR1cyBzdGF0dXM7Cgpkb3VibGUgYVsxMDBdOyBNUElfSW5pdCgmYXJnYywgJmFyZ3YpOyAvKiBJbml0aWFsaXplIE1QSSAqLwoKTVBJX0NvbW1fcmFuayhNUElfQ09NTV9XT1JMRCwgJm15cmFuayk7IC8qIEdldCByYW5rICovCgppZiggbXlyYW5rID09IDAgKSAvKiBTZW5kIGEgbWVzc2FnZSAqLwoKTVBJX1NlbmQoIGEsIDEwMCwgTVBJX0RPVUJMRSwgMSwgMTcsIE1QSV9DT01NX1dPUkxEICk7CgplbHNlIGlmKCBteXJhbmsgPT0gMSApIC8qIFJlY2VpdmUgYSBtZXNzYWdlICovCgpNUElfUmVjdiggYSwgMTAwLCBNUElfRE9VQkxFLCAwLCAxNywgTVBJX0NPTU1fV09STEQsICZzdGF0dXMgKTsKCk1QSV9GaW5hbGl6ZSgpOyAvKiBUZXJtaW5hdGUgTVBJICovCgp9