Question: 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.
 Answer the following questions about MPI. a.[6] Suppose we have an

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!