Question: I have to debug the following mpi program, however, I am unable to find the error. Any help is appreciated //Hangs #include mpi.h #include #include

I have to debug the following mpi program, however, I am unable to find the error. Any help is appreciated

//Hangs #include "mpi.h" #include #include

int main (int argc, char *argv[]) { int numranks, rank, len, buffer, root, count; char hostname[MPI_MAX_PROCESSOR_NAME];

MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numranks); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Get_processor_name(hostname, &len);

printf ("Task %d on %s starting... ", rank, hostname); root = 0; count = rank; buffer=0; if (rank == root){ buffer= 23; printf("Root: Number of MPI tasks is: %d ",numranks); }

MPI_Bcast(&buffer, count, MPI_INT, root, MPI_COMM_WORLD);

printf("Rank: %d, Buffer: %d",rank,buffer);

MPI_Finalize();

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!