Chris@10: Chris@10: Chris@10: An improved replacement for MPI_Alltoall - FFTW 3.3.3 Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: Chris@10:
Chris@10: Chris@10: Chris@10:

Chris@10: Previous: Advanced distributed-transpose interface, Chris@10: Up: FFTW MPI Transposes Chris@10:


Chris@10:
Chris@10: Chris@10:

6.7.3 An improved replacement for MPI_Alltoall

Chris@10: Chris@10:

We close this section by noting that FFTW's MPI transpose routines can Chris@10: be thought of as a generalization for the MPI_Alltoall function Chris@10: (albeit only for floating-point types), and in some circumstances can Chris@10: function as an improved replacement. Chris@10: Chris@10: Chris@10:

MPI_Alltoall is defined by the MPI standard as: Chris@10: Chris@10:

     int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
Chris@10:                       void *recvbuf, int recvcnt, MPI_Datatype recvtype,
Chris@10:                       MPI_Comm comm);
Chris@10: 
Chris@10:

In particular, for double* arrays in and out, Chris@10: consider the call: Chris@10: Chris@10:

     MPI_Alltoall(in, howmany, MPI_DOUBLE, out, howmany MPI_DOUBLE, comm);
Chris@10: 
Chris@10:

This is completely equivalent to: Chris@10: Chris@10:

     MPI_Comm_size(comm, &P);
Chris@10:      plan = fftw_mpi_plan_many_transpose(P, P, howmany, 1, 1, in, out, comm, FFTW_ESTIMATE);
Chris@10:      fftw_execute(plan);
Chris@10:      fftw_destroy_plan(plan);
Chris@10: 
Chris@10:

That is, computing a P × P transpose on P processes, Chris@10: with a block size of 1, is just a standard all-to-all communication. Chris@10: Chris@10:

However, using the FFTW routine instead of MPI_Alltoall may Chris@10: have certain advantages. First of all, FFTW's routine can operate Chris@10: in-place (in == out) whereas MPI_Alltoall can only Chris@10: operate out-of-place. Chris@10: Chris@10: Chris@10:

Second, even for out-of-place plans, FFTW's routine may be faster, Chris@10: especially if you need to perform the all-to-all communication many Chris@10: times and can afford to use FFTW_MEASURE or Chris@10: FFTW_PATIENT. It should certainly be no slower, not including Chris@10: the time to create the plan, since one of the possible algorithms that Chris@10: FFTW uses for an out-of-place transpose is simply to call Chris@10: MPI_Alltoall. However, FFTW also considers several other Chris@10: possible algorithms that, depending on your MPI implementation and Chris@10: your hardware, may be faster. Chris@10: Chris@10: Chris@10: Chris@10: Chris@10: