Write a program that performs the transpose of a square matrix A of arbitrary dimension (multiple of the number of tasks).
The matrix is split among the tasks and initialized so that each element is unique (use row-column number and task rank).
Thus you need to evaluate B of the form:
B = AT
Follows a visual representation of the matrices A and B (8x8 in the example):
Solve the problem distributing A and B by lines (or columns) over the tasks and using the collective communication MPI_ALLTOALL. Please note that this collective function works with data stored contiguously in memory, therefore choose carefully whether to store the matrix by lines or or columns. Can you tell why? (answer)
We ask you to:
check if the operation was successful
HINTS: |
|
C |
|
MPI_ALLTOALL |
|
MPI_INIT |
|
MPI_COMM_SIZE | |
MPI_COMM_RANK |
|
MPI_FINALIZE |
|
MPI_WTIME |
|
MPI_ABORT |
|
|
|
MPI_ALLTOALL |
|
MPI_INIT |
|
MPI_COMM_SIZE |
MPI_COMM_SIZE(COMM, SIZE, IERROR) |
MPI_COMM_RANK |
MPI_COMM_RANK(COMM, RANK, IERROR) |
MPI_FINALIZE |
|
MPI_WTIME |
|
MPI_ABORT |
MPI_ABORT(COMM, ERRCODE, IERROR) |