annotate src/fftw-3.3.3/doc/html/Basic-and-advanced-distribution-interfaces.html @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 37bf6b4a2645
children
rev   line source
Chris@10 1 <html lang="en">
Chris@10 2 <head>
Chris@10 3 <title>Basic and advanced distribution interfaces - FFTW 3.3.3</title>
Chris@10 4 <meta http-equiv="Content-Type" content="text/html">
Chris@10 5 <meta name="description" content="FFTW 3.3.3">
Chris@10 6 <meta name="generator" content="makeinfo 4.13">
Chris@10 7 <link title="Top" rel="start" href="index.html#Top">
Chris@10 8 <link rel="up" href="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
Chris@10 9 <link rel="prev" href="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
Chris@10 10 <link rel="next" href="Load-balancing.html#Load-balancing" title="Load balancing">
Chris@10 11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
Chris@10 12 <!--
Chris@10 13 This manual is for FFTW
Chris@10 14 (version 3.3.3, 25 November 2012).
Chris@10 15
Chris@10 16 Copyright (C) 2003 Matteo Frigo.
Chris@10 17
Chris@10 18 Copyright (C) 2003 Massachusetts Institute of Technology.
Chris@10 19
Chris@10 20 Permission is granted to make and distribute verbatim copies of
Chris@10 21 this manual provided the copyright notice and this permission
Chris@10 22 notice are preserved on all copies.
Chris@10 23
Chris@10 24 Permission is granted to copy and distribute modified versions of
Chris@10 25 this manual under the conditions for verbatim copying, provided
Chris@10 26 that the entire resulting derived work is distributed under the
Chris@10 27 terms of a permission notice identical to this one.
Chris@10 28
Chris@10 29 Permission is granted to copy and distribute translations of this
Chris@10 30 manual into another language, under the above conditions for
Chris@10 31 modified versions, except that this permission notice may be
Chris@10 32 stated in a translation approved by the Free Software Foundation.
Chris@10 33 -->
Chris@10 34 <meta http-equiv="Content-Style-Type" content="text/css">
Chris@10 35 <style type="text/css"><!--
Chris@10 36 pre.display { font-family:inherit }
Chris@10 37 pre.format { font-family:inherit }
Chris@10 38 pre.smalldisplay { font-family:inherit; font-size:smaller }
Chris@10 39 pre.smallformat { font-family:inherit; font-size:smaller }
Chris@10 40 pre.smallexample { font-size:smaller }
Chris@10 41 pre.smalllisp { font-size:smaller }
Chris@10 42 span.sc { font-variant:small-caps }
Chris@10 43 span.roman { font-family:serif; font-weight:normal; }
Chris@10 44 span.sansserif { font-family:sans-serif; font-weight:normal; }
Chris@10 45 --></style>
Chris@10 46 </head>
Chris@10 47 <body>
Chris@10 48 <div class="node">
Chris@10 49 <a name="Basic-and-advanced-distribution-interfaces"></a>
Chris@10 50 <p>
Chris@10 51 Next:&nbsp;<a rel="next" accesskey="n" href="Load-balancing.html#Load-balancing">Load balancing</a>,
Chris@10 52 Previous:&nbsp;<a rel="previous" accesskey="p" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>,
Chris@10 53 Up:&nbsp;<a rel="up" accesskey="u" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>
Chris@10 54 <hr>
Chris@10 55 </div>
Chris@10 56
Chris@10 57 <h4 class="subsection">6.4.1 Basic and advanced distribution interfaces</h4>
Chris@10 58
Chris@10 59 <p>As with the planner interface, the &lsquo;<samp><span class="samp">fftw_mpi_local_size</span></samp>&rsquo;
Chris@10 60 distribution interface is broken into basic and advanced
Chris@10 61 (&lsquo;<samp><span class="samp">_many</span></samp>&rsquo;) interfaces, where the latter allows you to specify the
Chris@10 62 block size manually and also to request block sizes when computing
Chris@10 63 multiple transforms simultaneously. These functions are documented
Chris@10 64 more exhaustively by the FFTW MPI Reference, but we summarize the
Chris@10 65 basic ideas here using a couple of two-dimensional examples.
Chris@10 66
Chris@10 67 <p>For the 100&nbsp;&times;&nbsp;200 complex-DFT example, above, we would find
Chris@10 68 the distribution by calling the following function in the basic
Chris@10 69 interface:
Chris@10 70
Chris@10 71 <pre class="example"> ptrdiff_t fftw_mpi_local_size_2d(ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,
Chris@10 72 ptrdiff_t *local_n0, ptrdiff_t *local_0_start);
Chris@10 73 </pre>
Chris@10 74 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005f2d-370"></a>
Chris@10 75 Given the total size of the data to be transformed (here, <code>n0 =
Chris@10 76 100</code> and <code>n1 = 200</code>) and an MPI communicator (<code>comm</code>), this
Chris@10 77 function provides three numbers.
Chris@10 78
Chris@10 79 <p>First, it describes the shape of the local data: the current process
Chris@10 80 should store a <code>local_n0</code> by <code>n1</code> slice of the overall
Chris@10 81 dataset, in row-major order (<code>n1</code> dimension contiguous), starting
Chris@10 82 at index <code>local_0_start</code>. That is, if the total dataset is
Chris@10 83 viewed as a <code>n0</code> by <code>n1</code> matrix, the current process should
Chris@10 84 store the rows <code>local_0_start</code> to
Chris@10 85 <code>local_0_start+local_n0-1</code>. Obviously, if you are running with
Chris@10 86 only a single MPI process, that process will store the entire array:
Chris@10 87 <code>local_0_start</code> will be zero and <code>local_n0</code> will be
Chris@10 88 <code>n0</code>. See <a href="Row_002dmajor-Format.html#Row_002dmajor-Format">Row-major Format</a>.
Chris@10 89 <a name="index-row_002dmajor-371"></a>
Chris@10 90
Chris@10 91 <p>Second, the return value is the total number of data elements (e.g.,
Chris@10 92 complex numbers for a complex DFT) that should be allocated for the
Chris@10 93 input and output arrays on the current process (ideally with
Chris@10 94 <code>fftw_malloc</code> or an &lsquo;<samp><span class="samp">fftw_alloc</span></samp>&rsquo; function, to ensure optimal
Chris@10 95 alignment). It might seem that this should always be equal to
Chris@10 96 <code>local_n0 * n1</code>, but this is <em>not</em> the case. FFTW's
Chris@10 97 distributed FFT algorithms require data redistributions at
Chris@10 98 intermediate stages of the transform, and in some circumstances this
Chris@10 99 may require slightly larger local storage. This is discussed in more
Chris@10 100 detail below, under <a href="Load-balancing.html#Load-balancing">Load balancing</a>.
Chris@10 101 <a name="index-fftw_005fmalloc-372"></a><a name="index-fftw_005falloc_005fcomplex-373"></a>
Chris@10 102
Chris@10 103 <p><a name="index-advanced-interface-374"></a>The advanced-interface &lsquo;<samp><span class="samp">local_size</span></samp>&rsquo; function for multidimensional
Chris@10 104 transforms returns the same three things (<code>local_n0</code>,
Chris@10 105 <code>local_0_start</code>, and the total number of elements to allocate),
Chris@10 106 but takes more inputs:
Chris@10 107
Chris@10 108 <pre class="example"> ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n,
Chris@10 109 ptrdiff_t howmany,
Chris@10 110 ptrdiff_t block0,
Chris@10 111 MPI_Comm comm,
Chris@10 112 ptrdiff_t *local_n0,
Chris@10 113 ptrdiff_t *local_0_start);
Chris@10 114 </pre>
Chris@10 115 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005fmany-375"></a>
Chris@10 116 The two-dimensional case above corresponds to <code>rnk = 2</code> and an
Chris@10 117 array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>.
Chris@10 118 This routine is for any <code>rnk &gt; 1</code>; one-dimensional transforms
Chris@10 119 have their own interface because they work slightly differently, as
Chris@10 120 discussed below.
Chris@10 121
Chris@10 122 <p>First, the advanced interface allows you to perform multiple
Chris@10 123 transforms at once, of interleaved data, as specified by the
Chris@10 124 <code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single
Chris@10 125 transform.)
Chris@10 126
Chris@10 127 <p>Second, here you can specify your desired block size in the <code>n0</code>
Chris@10 128 dimension, <code>block0</code>. To use FFTW's default block size, pass
Chris@10 129 <code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on
Chris@10 130 <code>P</code> processes, FFTW will return <code>local_n0</code> equal to
Chris@10 131 <code>block0</code> on the first <code>P / block0</code> processes (rounded down),
Chris@10 132 return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on
Chris@10 133 the next process, and <code>local_n0</code> equal to zero on any remaining
Chris@10 134 processes. In general, we recommend using the default block size
Chris@10 135 (which corresponds to <code>n0 / P</code>, rounded up).
Chris@10 136 <a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK-376"></a><a name="index-block-distribution-377"></a>
Chris@10 137
Chris@10 138 <p>For example, suppose you have <code>P = 4</code> processes and <code>n0 =
Chris@10 139 21</code>. The default will be a block size of <code>6</code>, which will give
Chris@10 140 <code>local_n0 = 6</code> on the first three processes and <code>local_n0 =
Chris@10 141 3</code> on the last process. Instead, however, you could specify
Chris@10 142 <code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code>
Chris@10 143 on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice,
Chris@10 144 while it may look superficially more &ldquo;balanced,&rdquo; has the same
Chris@10 145 critical path as FFTW's default but requires more communications.)
Chris@10 146
Chris@10 147 </body></html>
Chris@10 148