Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following questions about MPI. a . [ 6 ] Suppose we have an MPI program where we have four processes. MPI _ Comm

Answer the following questions about MPI.
a.[6] Suppose we have an MPI program where we have four processes.
MPI_Comm_Split() is called once. How many ranks can each process have after that
call? If there are several answers, specify them all and justify your answer.
b. For the following piece of code (assume very large number of cores):
int main(){
int globalnum =0;
int numprocs, rank;
int i=0;
MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#pragma omp parallel for reduction(+:globalnum)
for(i=0;i2+ rank ;i++
{
globalnum ++;
...rest of loop body ...
}
MPI_Finalize();
...
}
We execute the above code with: mpirun -n 5./progname
[5] What is the maximum number of threads we will end up having in the
whole system? Explain.
[5] Just before executing MPI_Finalize(), how many instances of globalnum
do we have in the system? Justify.
[5] Just after executing MPI_Finalize(), and before exiting main() how many
instances of globalnum do we have in the system? Justify
c.[9] Suppose we have three processes. Each process has an array p of integers of 3
elements as follows. Process 0 has [1,2,3], process 1 has 4,5,7, and process 2 has [7,
8,9. Suppose all the processes execute the following API:
MPI_Reduce(p, q,3, MPI_INT, MPI_BAND, 1, MPI_COMM_WORLD);
Where p is a pointer to the array and q is a pointer to a receiving array. Assume the
receiving array q is initially 0,0,0 for all processes. After executing the above function,
what will be the content of q for each process.
image text in transcribed

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

What is the cycle of intimate partner abuse?

Answered: 1 week ago