#include #include #include // provides MPI macros and functions int main (int argc, char *argv[]) { int my_rank; int P; int dest; int source; int tag=50; char hostname[256]; MPI_Status status; MPI_Init(&argc,&argv); // begin of every MPI program MPI_Comm_size(MPI_COMM_WORLD,&P); // number of processes MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); // my process number gethostname(hostname,255); // number of current process always between 0 and P-1 if (my_rank!=0) { dest = 0; MPI_Send(hostname,strlen(hostname)+1,MPI_CHAR, // Send data dest,tag,MPI_COMM_WORLD); // (blocking) } else { for (source=1; source