Looks like your browser cannot display the pdf here. Click here to link to the PDF!

#include "mpi.h"
#include
#include
#include

int main(int argc, char **argv)
{
int rank;
int size;
char hostname[256];
int buffer[10] = {1,2,3,4,5,6,7,8,9,10};
MPI_Status status;

MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if(size < 2)
{
MPI_Finalize(); return 0;
}
if(rank == 0)
{
// This is the master Program
MPI_Send(buffer, 10, MPI_INT, 1, 123, MPI_COMM_WORLD );
}
else
{
// char *temp = malloc(strlen(word)*sizeof(char));
buffer[0] = 11;
buffer[1] = 11;
buffer[2] = 11;
buffer[3] = 11;
MPI_Recv(buffer, 10, MPI_INT, 0, 123, MPI_COMM_WORLD, &status );
int i;
for(i = 0; i < 10; ++i)
printf("%d ", buffer[i]);
printf("\n");
// free(temp);
}

MPI_Finalize();

return 0;
}