annotate fft/fftw/fftw-3.3.4/doc/html/Basic-and-advanced-distribution-interfaces.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>Basic and advanced distribution interfaces - 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="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
Chris@19 10 <link rel="next" href="Load-balancing.html#Load-balancing" title="Load balancing">
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="Basic-and-advanced-distribution-interfaces"></a>
Chris@19 50 <p>
Chris@19 51 Next:&nbsp;<a rel="next" accesskey="n" href="Load-balancing.html#Load-balancing">Load balancing</a>,
Chris@19 52 Previous:&nbsp;<a rel="previous" accesskey="p" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</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.1 Basic and advanced distribution interfaces</h4>
Chris@19 58
Chris@19 59 <p>As with the planner interface, the &lsquo;<samp><span class="samp">fftw_mpi_local_size</span></samp>&rsquo;
Chris@19 60 distribution interface is broken into basic and advanced
Chris@19 61 (&lsquo;<samp><span class="samp">_many</span></samp>&rsquo;) interfaces, where the latter allows you to specify the
Chris@19 62 block size manually and also to request block sizes when computing
Chris@19 63 multiple transforms simultaneously. These functions are documented
Chris@19 64 more exhaustively by the FFTW MPI Reference, but we summarize the
Chris@19 65 basic ideas here using a couple of two-dimensional examples.
Chris@19 66
Chris@19 67 <p>For the 100&nbsp;&times;&nbsp;200 complex-DFT example, above, we would find
Chris@19 68 the distribution by calling the following function in the basic
Chris@19 69 interface:
Chris@19 70
Chris@19 71 <pre class="example"> ptrdiff_t fftw_mpi_local_size_2d(ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,
Chris@19 72 ptrdiff_t *local_n0, ptrdiff_t *local_0_start);
Chris@19 73 </pre>
Chris@19 74 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005f2d-373"></a>
Chris@19 75 Given the total size of the data to be transformed (here, <code>n0 =
Chris@19 76 100</code> and <code>n1 = 200</code>) and an MPI communicator (<code>comm</code>), this
Chris@19 77 function provides three numbers.
Chris@19 78
Chris@19 79 <p>First, it describes the shape of the local data: the current process
Chris@19 80 should store a <code>local_n0</code> by <code>n1</code> slice of the overall
Chris@19 81 dataset, in row-major order (<code>n1</code> dimension contiguous), starting
Chris@19 82 at index <code>local_0_start</code>. That is, if the total dataset is
Chris@19 83 viewed as a <code>n0</code> by <code>n1</code> matrix, the current process should
Chris@19 84 store the rows <code>local_0_start</code> to
Chris@19 85 <code>local_0_start+local_n0-1</code>. Obviously, if you are running with
Chris@19 86 only a single MPI process, that process will store the entire array:
Chris@19 87 <code>local_0_start</code> will be zero and <code>local_n0</code> will be
Chris@19 88 <code>n0</code>. See <a href="Row_002dmajor-Format.html#Row_002dmajor-Format">Row-major Format</a>.
Chris@19 89 <a name="index-row_002dmajor-374"></a>
Chris@19 90
Chris@19 91 <p>Second, the return value is the total number of data elements (e.g.,
Chris@19 92 complex numbers for a complex DFT) that should be allocated for the
Chris@19 93 input and output arrays on the current process (ideally with
Chris@19 94 <code>fftw_malloc</code> or an &lsquo;<samp><span class="samp">fftw_alloc</span></samp>&rsquo; function, to ensure optimal
Chris@19 95 alignment). It might seem that this should always be equal to
Chris@19 96 <code>local_n0 * n1</code>, but this is <em>not</em> the case. FFTW's
Chris@19 97 distributed FFT algorithms require data redistributions at
Chris@19 98 intermediate stages of the transform, and in some circumstances this
Chris@19 99 may require slightly larger local storage. This is discussed in more
Chris@19 100 detail below, under <a href="Load-balancing.html#Load-balancing">Load balancing</a>.
Chris@19 101 <a name="index-fftw_005fmalloc-375"></a><a name="index-fftw_005falloc_005fcomplex-376"></a>
Chris@19 102
Chris@19 103 <p><a name="index-advanced-interface-377"></a>The advanced-interface &lsquo;<samp><span class="samp">local_size</span></samp>&rsquo; function for multidimensional
Chris@19 104 transforms returns the same three things (<code>local_n0</code>,
Chris@19 105 <code>local_0_start</code>, and the total number of elements to allocate),
Chris@19 106 but takes more inputs:
Chris@19 107
Chris@19 108 <pre class="example"> ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n,
Chris@19 109 ptrdiff_t howmany,
Chris@19 110 ptrdiff_t block0,
Chris@19 111 MPI_Comm comm,
Chris@19 112 ptrdiff_t *local_n0,
Chris@19 113 ptrdiff_t *local_0_start);
Chris@19 114 </pre>
Chris@19 115 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005fmany-378"></a>
Chris@19 116 The two-dimensional case above corresponds to <code>rnk = 2</code> and an
Chris@19 117 array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>.
Chris@19 118 This routine is for any <code>rnk &gt; 1</code>; one-dimensional transforms
Chris@19 119 have their own interface because they work slightly differently, as
Chris@19 120 discussed below.
Chris@19 121
Chris@19 122 <p>First, the advanced interface allows you to perform multiple
Chris@19 123 transforms at once, of interleaved data, as specified by the
Chris@19 124 <code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single
Chris@19 125 transform.)
Chris@19 126
Chris@19 127 <p>Second, here you can specify your desired block size in the <code>n0</code>
Chris@19 128 dimension, <code>block0</code>. To use FFTW's default block size, pass
Chris@19 129 <code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on
Chris@19 130 <code>P</code> processes, FFTW will return <code>local_n0</code> equal to
Chris@19 131 <code>block0</code> on the first <code>P / block0</code> processes (rounded down),
Chris@19 132 return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on
Chris@19 133 the next process, and <code>local_n0</code> equal to zero on any remaining
Chris@19 134 processes. In general, we recommend using the default block size
Chris@19 135 (which corresponds to <code>n0 / P</code>, rounded up).
Chris@19 136 <a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK-379"></a><a name="index-block-distribution-380"></a>
Chris@19 137
Chris@19 138 <p>For example, suppose you have <code>P = 4</code> processes and <code>n0 =
Chris@19 139 21</code>. The default will be a block size of <code>6</code>, which will give
Chris@19 140 <code>local_n0 = 6</code> on the first three processes and <code>local_n0 =
Chris@19 141 3</code> on the last process. Instead, however, you could specify
Chris@19 142 <code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code>
Chris@19 143 on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice,
Chris@19 144 while it may look superficially more &ldquo;balanced,&rdquo; has the same
Chris@19 145 critical path as FFTW's default but requires more communications.)
Chris@19 146
Chris@19 147 </body></html>
Chris@19 148