annotate src/fftw-3.3.3/doc/html/Transposed-distributions.html @ 95:89f5e221ed7b

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