Chris@42: Chris@42: Chris@42: Chris@42: Chris@42:
Chris@42:Chris@42: Next: FFTW MPI Transposes, Previous: Multi-dimensional MPI DFTs of Real Data, Up: Distributed-memory FFTW with MPI [Contents][Index]
Chris@42:FFTW’s MPI interface also supports multi-dimensional ‘r2r’ Chris@42: transforms of all kinds supported by the serial interface Chris@42: (e.g. discrete cosine and sine transforms, discrete Hartley Chris@42: transforms, etc.). Only multi-dimensional ‘r2r’ transforms, not Chris@42: one-dimensional transforms, are currently parallelized. Chris@42:
Chris@42: Chris@42:These are used much like the multidimensional complex DFTs discussed
Chris@42: above, except that the data is real rather than complex, and one needs
Chris@42: to pass an r2r transform kind (fftw_r2r_kind
) for each
Chris@42: dimension as in the serial FFTW (see More DFTs of Real Data).
Chris@42:
For example, one might perform a two-dimensional L × M that is Chris@42: an REDFT10 (DCT-II) in the first dimension and an RODFT10 (DST-II) in Chris@42: the second dimension with code like: Chris@42:
Chris@42:const ptrdiff_t L = ..., M = ...; Chris@42: fftw_plan plan; Chris@42: double *data; Chris@42: ptrdiff_t alloc_local, local_n0, local_0_start, i, j; Chris@42: Chris@42: /* get local data size and allocate */ Chris@42: alloc_local = fftw_mpi_local_size_2d(L, M, MPI_COMM_WORLD, Chris@42: &local_n0, &local_0_start); Chris@42: data = fftw_alloc_real(alloc_local); Chris@42: Chris@42: /* create plan for in-place REDFT10 x RODFT10 */ Chris@42: plan = fftw_mpi_plan_r2r_2d(L, M, data, data, MPI_COMM_WORLD, Chris@42: FFTW_REDFT10, FFTW_RODFT10, FFTW_MEASURE); Chris@42: Chris@42: /* initialize data to some function my_function(x,y) */ Chris@42: for (i = 0; i < local_n0; ++i) for (j = 0; j < M; ++j) Chris@42: data[i*M + j] = my_function(local_0_start + i, j); Chris@42: Chris@42: /* compute transforms, in-place, as many times as desired */ Chris@42: fftw_execute(plan); Chris@42: Chris@42: fftw_destroy_plan(plan); Chris@42:
Notice that we use the same ‘local_size’ functions as we did for
Chris@42: complex data, only now we interpret the sizes in terms of real rather
Chris@42: than complex values, and correspondingly use fftw_alloc_real
.
Chris@42: