annotate fft/fftw/fftw-3.3.4/doc/html/Transposed-distributions.html @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents 26056e866c29
children
rev   line source
Chris@19 1 <html lang="en">
Chris@19 2 <head>
Chris@19 3 <title>Transposed distributions - FFTW 3.3.4</title>
Chris@19 4 <meta http-equiv="Content-Type" content="text/html">
Chris@19 5 <meta name="description" content="FFTW 3.3.4">
Chris@19 6 <meta name="generator" content="makeinfo 4.13">
Chris@19 7 <link title="Top" rel="start" href="index.html#Top">
Chris@19 8 <link rel="up" href="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
Chris@19 9 <link rel="prev" href="Load-balancing.html#Load-balancing" title="Load balancing">
Chris@19 10 <link rel="next" href="One_002ddimensional-distributions.html#One_002ddimensional-distributions" title="One-dimensional distributions">
Chris@19 11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
Chris@19 12 <!--
Chris@19 13 This manual is for FFTW
Chris@19 14 (version 3.3.4, 20 September 2013).
Chris@19 15
Chris@19 16 Copyright (C) 2003 Matteo Frigo.
Chris@19 17
Chris@19 18 Copyright (C) 2003 Massachusetts Institute of Technology.
Chris@19 19
Chris@19 20 Permission is granted to make and distribute verbatim copies of
Chris@19 21 this manual provided the copyright notice and this permission
Chris@19 22 notice are preserved on all copies.
Chris@19 23
Chris@19 24 Permission is granted to copy and distribute modified versions of
Chris@19 25 this manual under the conditions for verbatim copying, provided
Chris@19 26 that the entire resulting derived work is distributed under the
Chris@19 27 terms of a permission notice identical to this one.
Chris@19 28
Chris@19 29 Permission is granted to copy and distribute translations of this
Chris@19 30 manual into another language, under the above conditions for
Chris@19 31 modified versions, except that this permission notice may be
Chris@19 32 stated in a translation approved by the Free Software Foundation.
Chris@19 33 -->
Chris@19 34 <meta http-equiv="Content-Style-Type" content="text/css">
Chris@19 35 <style type="text/css"><!--
Chris@19 36 pre.display { font-family:inherit }
Chris@19 37 pre.format { font-family:inherit }
Chris@19 38 pre.smalldisplay { font-family:inherit; font-size:smaller }
Chris@19 39 pre.smallformat { font-family:inherit; font-size:smaller }
Chris@19 40 pre.smallexample { font-size:smaller }
Chris@19 41 pre.smalllisp { font-size:smaller }
Chris@19 42 span.sc { font-variant:small-caps }
Chris@19 43 span.roman { font-family:serif; font-weight:normal; }
Chris@19 44 span.sansserif { font-family:sans-serif; font-weight:normal; }
Chris@19 45 --></style>
Chris@19 46 </head>
Chris@19 47 <body>
Chris@19 48 <div class="node">
Chris@19 49 <a name="Transposed-distributions"></a>
Chris@19 50 <p>
Chris@19 51 Next:&nbsp;<a rel="next" accesskey="n" href="One_002ddimensional-distributions.html#One_002ddimensional-distributions">One-dimensional distributions</a>,
Chris@19 52 Previous:&nbsp;<a rel="previous" accesskey="p" href="Load-balancing.html#Load-balancing">Load balancing</a>,
Chris@19 53 Up:&nbsp;<a rel="up" accesskey="u" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>
Chris@19 54 <hr>
Chris@19 55 </div>
Chris@19 56
Chris@19 57 <h4 class="subsection">6.4.3 Transposed distributions</h4>
Chris@19 58
Chris@19 59 <p>Internally, FFTW's MPI transform algorithms work by first computing
Chris@19 60 transforms of the data local to each process, then by globally
Chris@19 61 <em>transposing</em> the data in some fashion to redistribute the data
Chris@19 62 among the processes, transforming the new data local to each process,
Chris@19 63 and transposing back. For example, a two-dimensional <code>n0</code> by
Chris@19 64 <code>n1</code> array, distributed across the <code>n0</code> dimension, is
Chris@19 65 transformd by: (i) transforming the <code>n1</code> dimension, which are
Chris@19 66 local to each process; (ii) transposing to an <code>n1</code> by <code>n0</code>
Chris@19 67 array, distributed across the <code>n1</code> dimension; (iii) transforming
Chris@19 68 the <code>n0</code> dimension, which is now local to each process; (iv)
Chris@19 69 transposing back.
Chris@19 70 <a name="index-transpose-382"></a>
Chris@19 71
Chris@19 72 <p>However, in many applications it is acceptable to compute a
Chris@19 73 multidimensional DFT whose results are produced in transposed order
Chris@19 74 (e.g., <code>n1</code> by <code>n0</code> in two dimensions). This provides a
Chris@19 75 significant performance advantage, because it means that the final
Chris@19 76 transposition step can be omitted. FFTW supports this optimization,
Chris@19 77 which you specify by passing the flag <code>FFTW_MPI_TRANSPOSED_OUT</code>
Chris@19 78 to the planner routines. To compute the inverse transform of
Chris@19 79 transposed output, you specify <code>FFTW_MPI_TRANSPOSED_IN</code> to tell
Chris@19 80 it that the input is transposed. In this section, we explain how to
Chris@19 81 interpret the output format of such a transform.
Chris@19 82 <a name="index-FFTW_005fMPI_005fTRANSPOSED_005fOUT-383"></a><a name="index-FFTW_005fMPI_005fTRANSPOSED_005fIN-384"></a>
Chris@19 83
Chris@19 84 <p>Suppose you have are transforming multi-dimensional data with (at
Chris@19 85 least two) dimensions n<sub>0</sub>&nbsp;&times;&nbsp;n<sub>1</sub>&nbsp;&times;&nbsp;n<sub>2</sub>&nbsp;&times;&nbsp;&hellip;&nbsp;&times;&nbsp;n<sub>d-1</sub>. As always, it is distributed along
Chris@19 86 the first dimension n<sub>0</sub>. Now, if we compute its DFT with the
Chris@19 87 <code>FFTW_MPI_TRANSPOSED_OUT</code> flag, the resulting output data are stored
Chris@19 88 with the first <em>two</em> dimensions transposed: n<sub>1</sub>&nbsp;&times;&nbsp;n<sub>0</sub>&nbsp;&times;&nbsp;n<sub>2</sub>&nbsp;&times;&hellip;&times;&nbsp;n<sub>d-1</sub>,
Chris@19 89 distributed along the n<sub>1</sub> dimension. Conversely, if we take the
Chris@19 90 n<sub>1</sub>&nbsp;&times;&nbsp;n<sub>0</sub>&nbsp;&times;&nbsp;n<sub>2</sub>&nbsp;&times;&hellip;&times;&nbsp;n<sub>d-1</sub> data and transform it with the
Chris@19 91 <code>FFTW_MPI_TRANSPOSED_IN</code> flag, then the format goes back to the
Chris@19 92 original n<sub>0</sub>&nbsp;&times;&nbsp;n<sub>1</sub>&nbsp;&times;&nbsp;n<sub>2</sub>&nbsp;&times;&nbsp;&hellip;&nbsp;&times;&nbsp;n<sub>d-1</sub> array.
Chris@19 93
Chris@19 94 <p>There are two ways to find the portion of the transposed array that
Chris@19 95 resides on the current process. First, you can simply call the
Chris@19 96 appropriate &lsquo;<samp><span class="samp">local_size</span></samp>&rsquo; function, passing n<sub>1</sub>&nbsp;&times;&nbsp;n<sub>0</sub>&nbsp;&times;&nbsp;n<sub>2</sub>&nbsp;&times;&hellip;&times;&nbsp;n<sub>d-1</sub> (the
Chris@19 97 transposed dimensions). This would mean calling the &lsquo;<samp><span class="samp">local_size</span></samp>&rsquo;
Chris@19 98 function twice, once for the transposed and once for the
Chris@19 99 non-transposed dimensions. Alternatively, you can call one of the
Chris@19 100 &lsquo;<samp><span class="samp">local_size_transposed</span></samp>&rsquo; functions, which returns both the
Chris@19 101 non-transposed and transposed data distribution from a single call.
Chris@19 102 For example, for a 3d transform with transposed output (or input), you
Chris@19 103 might call:
Chris@19 104
Chris@19 105 <pre class="example"> ptrdiff_t fftw_mpi_local_size_3d_transposed(
Chris@19 106 ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, MPI_Comm comm,
Chris@19 107 ptrdiff_t *local_n0, ptrdiff_t *local_0_start,
Chris@19 108 ptrdiff_t *local_n1, ptrdiff_t *local_1_start);
Chris@19 109 </pre>
Chris@19 110 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005f3d_005ftransposed-385"></a>
Chris@19 111 Here, <code>local_n0</code> and <code>local_0_start</code> give the size and
Chris@19 112 starting index of the <code>n0</code> dimension for the
Chris@19 113 <em>non</em>-transposed data, as in the previous sections. For
Chris@19 114 <em>transposed</em> data (e.g. the output for
Chris@19 115 <code>FFTW_MPI_TRANSPOSED_OUT</code>), <code>local_n1</code> and
Chris@19 116 <code>local_1_start</code> give the size and starting index of the <code>n1</code>
Chris@19 117 dimension, which is the first dimension of the transposed data
Chris@19 118 (<code>n1</code> by <code>n0</code> by <code>n2</code>).
Chris@19 119
Chris@19 120 <p>(Note that <code>FFTW_MPI_TRANSPOSED_IN</code> is completely equivalent to
Chris@19 121 performing <code>FFTW_MPI_TRANSPOSED_OUT</code> and passing the first two
Chris@19 122 dimensions to the planner in reverse order, or vice versa. If you
Chris@19 123 pass <em>both</em> the <code>FFTW_MPI_TRANSPOSED_IN</code> and
Chris@19 124 <code>FFTW_MPI_TRANSPOSED_OUT</code> flags, it is equivalent to swapping the
Chris@19 125 first two dimensions passed to the planner and passing <em>neither</em>
Chris@19 126 flag.)
Chris@19 127
Chris@19 128 </body></html>
Chris@19 129