Quiz for Collective Communication I module
- The statement that a collective communication routine is locally
blocking means that the next statement in the program on a particular
node isn't executed until
A. all processes in the job have completed this statement
B. all processes in the named communicator have completed this statement
C. the local process has completed this statement
D. the root process has completed this statement.
- The root process in an MPI_Bcast call as implemented by MPI/PRO executes its
next statement after:
A. all processes in the job have acknowledged receipt
of the data;
B. all processes in the named communicator have acknowledged
receipt of the data
C. all processes in the named communicatior have
reached this call
D. all data have been queued for sending, even though
some processes may not have reached this call yet.
- Check all that apply: which of the following Fortran SPMD
code fragments are erroneous? Assume that the codes are running on 2
or more processors, and that all lines of code relevant to the
question are shown.
-
call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierror)
- if (rank .eq. 0) then
- MPI_BCAST(buf, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
- else
- ! no call to MPI_BCAST
- end if
-
rbuf = 1000
- do while (rbuf .gt. 1)
- ! calculation of sbuf not shown
-
- call MPI_REDUCE (sbuf, rbuf, 1, MPI_REAL,
MPI_MAX, root, MPI_COMM_WORLD, ierror)
- end do
call MPI_REDUCE(buf, buf, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, ierror)
call MPI_SCATTER(sbuf, 5, MPI_REAL, rbuf, 10, MPI_REAL, 0,
MPI_COMM_WORLD, ierror)
-
call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierror)
- call MPI_GATHER(sbuf, 5, MPI_REAL, rbuf, 5*size, MPI_REAL, 0,
MPI_COMM_WORLD, ierror)
-
Check all that apply: Which is safe to assume after a call to
MPI_ALLGATHER returns?
The send buffer can be safely overwritten.
The receive buffer can be safely used.
All participating processes have returned from the call.
- In an MPI_Scatter call, which is not _always_ true?
A. each process must receive as many elements as the root process sends
B. each process must receive as many bytes as the root process sends
C. each process in the named communicator must call MPI_Scatter, specifying the same root process;
D. each process must specify a receive buffer whose size is at least 1/N of
the total data sent by the root process.
- In an MPI_Gather call, which is not _ever_ true?
A. the receive buffer on the root node has a size greater than
N times that of the buffers on the other nodes
B. the buffer on the root node is equal to the size of the buffers
on the sending nodes
C. one of the non-root processes proceeds to its next statement before
the root process does
D. the root process proceeds to the next statement before one
of the non-root processes reaches its MPI_Gather call.
- Which of the following is illegal? One process in a communicator calls
MPI_Gather with a different
A. receive buffer
B. send buffer
C. count and datatype but the product of the count and the size
of the datatype is the same as the others
D. root rank
- Which is illegal for an MPI_Reduce call that is legal for MPI_Gather?
One process specifies a different
A. receive buffer
B. send buffer
C. count and datatype but the product of the count and the size of the
datatype is the same as the others
D. root rank
-
"Basics of MPI Programming" introduced the concept of communicator and
discussed how different processes could have different ranks in
different communicators. The following processes have the following
ranks in two communicators:
-
Rank in Communicator
| | process 1 | process 2 |
process 3 | process 4 |
|---|
| comm1 | 0 | 1 | 2 | 3 |
| comm2 | 3 | 2 | 1 | 0 |
After the following SPMD C code fragment:
-
- MPI_Comm_rank (comm1, &rank1);
MPI_Gather(&rank1, 1, MPI_INT, &rbuf, 1, MPI_INT, 0, comm1);
What does the rbuf array hold on the root process?
{0,1,2,3}
{3,2,1,0}
- For the communicators described in question 9,
what does rbuf hold on the root process after this SPMD C code fragment?
-
- MPI_Comm_rank (comm2, &rank2);
MPI_Gather(&rank2, 1, MPI_INT, &rbuf, 1, MPI_INT, 0, comm2);
{0,1,2,3}
{3,2,1,0}
-
Will the same process be the root for the MPI_Gather calls in
questions 9 and 10?
yes
no
- A user calls MPI_Reduce with the MPI_BOR operator. The input vector on
each of four tasks has the integers from 1 to 4 in order. The output vector
will be
A. the integers from 1 to 4 in order
B. the integers from 1 to 4
in reverse order
C. all 0's
D. all 7's
- A user again calls MPI_Reduce with the MPI_BOR operator. This time the
input vector on each of the four tasks has the integers from 1 to 4, but they
are rotated so that the list starts with 1 on task 0, 2 on tesk 1, etc. The
output vector will be
A. the integers from 1 to 4 in order
B. the integers from 1 to 4 in reverse order
C. all 0's
D. all 7's
- In the most efficient implementation of an MPI_Allreduce function, there
will be how many stages?
A. 1
B. log2(N)
C. 2*log2(N)
D. N
- A code has been organized so that it has good load balance but the
processes are subject to frequent interruptions which cause them to
temporarily get out of sync by substational amounts. If task 0 needs to
broadcast a large amount of data (> eager threshold) from a
buffer in the midst of the iteration, which strategy will incur the least
synchronization overhead?
A. MPI_Bcast
B. MPI_Send in a loop on task 0
C. MPI_Isend in a loop on task 0 followed by MPI_Waitall right after the loop
D. they're all about the same.
If you would like an explanation of the correct answers to
show up along with your score, select Yes in the box below:
Show Answers: