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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started