cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: An improved replacement for MPI_Alltoall cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Previous: , Up: FFTW MPI Transposes   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

6.7.3 An improved replacement for MPI_Alltoall

cannam@127: cannam@127:

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

cannam@127: cannam@127:

MPI_Alltoall is defined by the MPI standard as: cannam@127:

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

In particular, for double* arrays in and out, cannam@127: consider the call: cannam@127:

cannam@127:
cannam@127:
MPI_Alltoall(in, howmany, MPI_DOUBLE, out, howmany MPI_DOUBLE, comm);
cannam@127: 
cannam@127: cannam@127:

This is completely equivalent to: cannam@127:

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

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

cannam@127:

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

cannam@127: cannam@127:

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

cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: