/* ----------------------------------------------------------------------- * Code: fixed.c * Lab: MPI Point-to-Point Communication * Solution program showing the use of a non-blocking send * to eliminate deadlock. * Usage: fixed * Run on two nodes * Author: Roslyn Leibensperger Last revised: 8/30/95 RYL * ------------------------------------------------------------------------ */ #include #include "mpi.h" #define MSGLEN 2048 /* length of message in elements */ #define TAG_A 100 #define TAG_B 200 main( argc, argv ) int argc; char **argv; { float message1 [MSGLEN], /* message buffers */ message2 [MSGLEN]; int rank, /* rank of task in communicator */ dest, source, /* rank in communicator of destination */ /* and source tasks */ send_tag, recv_tag, /* message tags */ i; MPI_Status status; /* status of communication */ MPI_Request request; /* handle for pending communication */ MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); printf ( " Task %d initialized\n", rank ); /* initialize message buffers */ for ( i=0; i