Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: FFTW 3.3.5: An improved replacement for MPI_Alltoall Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: Chris@42:
Chris@42:

Chris@42: Previous: , Up: FFTW MPI Transposes   [Contents][Index]

Chris@42:
Chris@42:
Chris@42: Chris@42:

6.7.3 An improved replacement for MPI_Alltoall

Chris@42: Chris@42:

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

Chris@42: Chris@42:

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

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

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

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

This is completely equivalent to: Chris@42:

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

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

Chris@42:

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

Chris@42: Chris@42:

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

Chris@42: Chris@42: Chris@42: Chris@42: Chris@42: