1. Write a program to send rows of a matrix (stored in column-major form)
to the other processors.
Let processor 0 have the entire matrix, which has as many rows as
processors.
Processor 0 sends row i to processor i.
Processor i reads that row into a local array that holds only that row.
That is, processor 0 has a matrix A(N,M) while the other processors
have a row B(M).
1. Write the program to handle the case where the matrix is square.
2. Write the program to handle a number of columns read from the terminal.
C programmers may send columns of a matrix stored in row-major form if they
prefer.
If you have time, try one of the following. If you don't have time, think
about how you would program these.
2. Write a program to transpose a matrix, where each processor has a part of
the matrix. Use topologies to define a 2-Dimensional partitioning of the
matrix across the processors, and assume that all processors have the same
size submatrix.
1. Use MPI_Send and MPI_Recv to send the block, the transpose
the block.
2. Use MPI_Sendrecv instead.
3. Create a datatype that allows you to receive the block already
transposed.
3. Write a program to send the "ghostpoints" of a 2-Dimensional mesh to the
neighboring processors. Assume that each processor has the same size subblock.
1. Use topologies to find the neighbors
2. Define a datatype for the ``rows''
3. Use MPI_Sendrecv or MPI_IRecv and MPI_Send with
MPI_Waitall.
4. Use MPI_Isend and MPI_Irecv to start the communication, do some
computation on the interior, and then use MPI_Waitany to
process the boundaries as they arrive
The same approach works for general datastructures, such as unstructured
meshes.
4. Do 3, but for 3-Dimensional meshes. You will need MPI_Type_Hvector.