Answered step by step
Verified Expert Solution
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 Suppose we have an MPI program where we have four processes.
MPICommSplit 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 ;
int numprocs, rank;
int ;
MPIInitNULL NULL;
MPICommsizeMPICOMMWORLD, &numprocs;
MPICommrankMPICOMMWORLD, &rank;
#pragma omp parallel for reduction:globalnum
for; rank ;
globalnum ;
rest of loop body
MPIFinalize;
We execute the above code with: mpirun n progname
What is the maximum number of threads we will end up having in the
whole system? Explain.
Just before executing MPIFinalize how many instances of globalnum
do we have in the system? Justify.
Just after executing MPIFinalize and before exiting main how many
instances of globalnum do we have in the system? Justify
c Suppose we have three processes. Each process has an array p of integers of
elements as follows. Process has process has and process has
Suppose all the processes execute the following API:
MPIReducep q MPIINT, MPIBAND, MPICOMMWORLD;
Where is a pointer to the array and is a pointer to a receiving array. Assume the
receiving array is initially for all processes. After executing the above function,
what will be the content of for each process.
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