Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

Collect a small sample of about

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

Do you currently have a team agreement?

Answered: 1 week ago