Let’s say you have a 3d array A[I][J][K], but you want to permute it into B[J][K][I].
This problem is similar to, but different from, the 2-d array transpose problem discussed here:
Can you transpose array when sending using MPI_Type_create_subarray?.
The MPI standard provides examples of multi-dimensional array operations with user-defined datatypes, but not this particular case: http://www.mpi-forum.org/docs/mpi-11-html/node61.html
The way to do this is with
MPI_TYPE_VECTORandMPI_TYPE_CREATE_HVECTOR, but the devil is in the details.Now you can feed
transposed_typeto your send/receive call or make it your MPI file view.