Chris@82: Chris@82: Chris@82: Chris@82: Chris@82:
Chris@82:Chris@82: Previous: Advanced distributed-transpose interface, Up: FFTW MPI Transposes [Contents][Index]
Chris@82:We close this section by noting that FFTW’s MPI transpose routines can
Chris@82: be thought of as a generalization for the MPI_Alltoall
function
Chris@82: (albeit only for floating-point types), and in some circumstances can
Chris@82: function as an improved replacement.
Chris@82:
Chris@82:
MPI_Alltoall
is defined by the MPI standard as:
Chris@82:
int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype, Chris@82: void *recvbuf, int recvcnt, MPI_Datatype recvtype, Chris@82: MPI_Comm comm); Chris@82:
In particular, for double*
arrays in
and out
,
Chris@82: consider the call:
Chris@82:
MPI_Alltoall(in, howmany, MPI_DOUBLE, out, howmany MPI_DOUBLE, comm); Chris@82:
This is completely equivalent to: Chris@82:
Chris@82:MPI_Comm_size(comm, &P); Chris@82: plan = fftw_mpi_plan_many_transpose(P, P, howmany, 1, 1, in, out, comm, FFTW_ESTIMATE); Chris@82: fftw_execute(plan); Chris@82: fftw_destroy_plan(plan); Chris@82:
That is, computing a P × P
Chris@82: transpose on P
processes,
Chris@82: with a block size of 1, is just a standard all-to-all communication.
Chris@82:
However, using the FFTW routine instead of MPI_Alltoall
may
Chris@82: have certain advantages. First of all, FFTW’s routine can operate
Chris@82: in-place (in == out
) whereas MPI_Alltoall
can only
Chris@82: operate out-of-place.
Chris@82:
Chris@82:
Second, even for out-of-place plans, FFTW’s routine may be faster,
Chris@82: especially if you need to perform the all-to-all communication many
Chris@82: times and can afford to use FFTW_MEASURE
or
Chris@82: FFTW_PATIENT
. It should certainly be no slower, not including
Chris@82: the time to create the plan, since one of the possible algorithms that
Chris@82: FFTW uses for an out-of-place transpose is simply to call
Chris@82: MPI_Alltoall
. However, FFTW also considers several other
Chris@82: possible algorithms that, depending on your MPI implementation and
Chris@82: your hardware, may be faster.
Chris@82:
Chris@82:
Chris@82: