annotate src/fftw-3.3.8/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 d0c2a83c1364
children
rev   line source
Chris@82 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Chris@82 2 <html>
Chris@82 3 <!-- This manual is for FFTW
Chris@82 4 (version 3.3.8, 24 May 2018).
Chris@82 5
Chris@82 6 Copyright (C) 2003 Matteo Frigo.
Chris@82 7
Chris@82 8 Copyright (C) 2003 Massachusetts Institute of Technology.
Chris@82 9
Chris@82 10 Permission is granted to make and distribute verbatim copies of this
Chris@82 11 manual provided the copyright notice and this permission notice are
Chris@82 12 preserved on all copies.
Chris@82 13
Chris@82 14 Permission is granted to copy and distribute modified versions of this
Chris@82 15 manual under the conditions for verbatim copying, provided that the
Chris@82 16 entire resulting derived work is distributed under the terms of a
Chris@82 17 permission notice identical to this one.
Chris@82 18
Chris@82 19 Permission is granted to copy and distribute translations of this manual
Chris@82 20 into another language, under the above conditions for modified versions,
Chris@82 21 except that this permission notice may be stated in a translation
Chris@82 22 approved by the Free Software Foundation. -->
Chris@82 23 <!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
Chris@82 24 <head>
Chris@82 25 <title>FFTW 3.3.8: Basic and advanced distribution interfaces</title>
Chris@82 26
Chris@82 27 <meta name="description" content="FFTW 3.3.8: Basic and advanced distribution interfaces">
Chris@82 28 <meta name="keywords" content="FFTW 3.3.8: Basic and advanced distribution interfaces">
Chris@82 29 <meta name="resource-type" content="document">
Chris@82 30 <meta name="distribution" content="global">
Chris@82 31 <meta name="Generator" content="makeinfo">
Chris@82 32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Chris@82 33 <link href="index.html#Top" rel="start" title="Top">
Chris@82 34 <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
Chris@82 35 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
Chris@82 36 <link href="MPI-Data-Distribution.html#MPI-Data-Distribution" rel="up" title="MPI Data Distribution">
Chris@82 37 <link href="Load-balancing.html#Load-balancing" rel="next" title="Load balancing">
Chris@82 38 <link href="MPI-Data-Distribution.html#MPI-Data-Distribution" rel="prev" title="MPI Data Distribution">
Chris@82 39 <style type="text/css">
Chris@82 40 <!--
Chris@82 41 a.summary-letter {text-decoration: none}
Chris@82 42 blockquote.indentedblock {margin-right: 0em}
Chris@82 43 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
Chris@82 44 blockquote.smallquotation {font-size: smaller}
Chris@82 45 div.display {margin-left: 3.2em}
Chris@82 46 div.example {margin-left: 3.2em}
Chris@82 47 div.lisp {margin-left: 3.2em}
Chris@82 48 div.smalldisplay {margin-left: 3.2em}
Chris@82 49 div.smallexample {margin-left: 3.2em}
Chris@82 50 div.smalllisp {margin-left: 3.2em}
Chris@82 51 kbd {font-style: oblique}
Chris@82 52 pre.display {font-family: inherit}
Chris@82 53 pre.format {font-family: inherit}
Chris@82 54 pre.menu-comment {font-family: serif}
Chris@82 55 pre.menu-preformatted {font-family: serif}
Chris@82 56 pre.smalldisplay {font-family: inherit; font-size: smaller}
Chris@82 57 pre.smallexample {font-size: smaller}
Chris@82 58 pre.smallformat {font-family: inherit; font-size: smaller}
Chris@82 59 pre.smalllisp {font-size: smaller}
Chris@82 60 span.nolinebreak {white-space: nowrap}
Chris@82 61 span.roman {font-family: initial; font-weight: normal}
Chris@82 62 span.sansserif {font-family: sans-serif; font-weight: normal}
Chris@82 63 ul.no-bullet {list-style: none}
Chris@82 64 -->
Chris@82 65 </style>
Chris@82 66
Chris@82 67
Chris@82 68 </head>
Chris@82 69
Chris@82 70 <body lang="en">
Chris@82 71 <a name="Basic-and-advanced-distribution-interfaces"></a>
Chris@82 72 <div class="header">
Chris@82 73 <p>
Chris@82 74 Next: <a href="Load-balancing.html#Load-balancing" accesskey="n" rel="next">Load balancing</a>, Previous: <a href="MPI-Data-Distribution.html#MPI-Data-Distribution" accesskey="p" rel="prev">MPI Data Distribution</a>, Up: <a href="MPI-Data-Distribution.html#MPI-Data-Distribution" accesskey="u" rel="up">MPI Data Distribution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
Chris@82 75 </div>
Chris@82 76 <hr>
Chris@82 77 <a name="Basic-and-advanced-distribution-interfaces-1"></a>
Chris@82 78 <h4 class="subsection">6.4.1 Basic and advanced distribution interfaces</h4>
Chris@82 79
Chris@82 80 <p>As with the planner interface, the &lsquo;<samp>fftw_mpi_local_size</samp>&rsquo;
Chris@82 81 distribution interface is broken into basic and advanced
Chris@82 82 (&lsquo;<samp>_many</samp>&rsquo;) interfaces, where the latter allows you to specify the
Chris@82 83 block size manually and also to request block sizes when computing
Chris@82 84 multiple transforms simultaneously. These functions are documented
Chris@82 85 more exhaustively by the FFTW MPI Reference, but we summarize the
Chris@82 86 basic ideas here using a couple of two-dimensional examples.
Chris@82 87 </p>
Chris@82 88 <p>For the 100&nbsp;&times;&nbsp;200
Chris@82 89 complex-DFT example, above, we would find
Chris@82 90 the distribution by calling the following function in the basic
Chris@82 91 interface:
Chris@82 92 </p>
Chris@82 93 <div class="example">
Chris@82 94 <pre class="example">ptrdiff_t fftw_mpi_local_size_2d(ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,
Chris@82 95 ptrdiff_t *local_n0, ptrdiff_t *local_0_start);
Chris@82 96 </pre></div>
Chris@82 97 <a name="index-fftw_005fmpi_005flocal_005fsize_005f2d-1"></a>
Chris@82 98
Chris@82 99 <p>Given the total size of the data to be transformed (here, <code>n0 =
Chris@82 100 100</code> and <code>n1 = 200</code>) and an MPI communicator (<code>comm</code>), this
Chris@82 101 function provides three numbers.
Chris@82 102 </p>
Chris@82 103 <p>First, it describes the shape of the local data: the current process
Chris@82 104 should store a <code>local_n0</code> by <code>n1</code> slice of the overall
Chris@82 105 dataset, in row-major order (<code>n1</code> dimension contiguous), starting
Chris@82 106 at index <code>local_0_start</code>. That is, if the total dataset is
Chris@82 107 viewed as a <code>n0</code> by <code>n1</code> matrix, the current process should
Chris@82 108 store the rows <code>local_0_start</code> to
Chris@82 109 <code>local_0_start+local_n0-1</code>. Obviously, if you are running with
Chris@82 110 only a single MPI process, that process will store the entire array:
Chris@82 111 <code>local_0_start</code> will be zero and <code>local_n0</code> will be
Chris@82 112 <code>n0</code>. See <a href="Row_002dmajor-Format.html#Row_002dmajor-Format">Row-major Format</a>.
Chris@82 113 <a name="index-row_002dmajor-4"></a>
Chris@82 114 </p>
Chris@82 115
Chris@82 116 <p>Second, the return value is the total number of data elements (e.g.,
Chris@82 117 complex numbers for a complex DFT) that should be allocated for the
Chris@82 118 input and output arrays on the current process (ideally with
Chris@82 119 <code>fftw_malloc</code> or an &lsquo;<samp>fftw_alloc</samp>&rsquo; function, to ensure optimal
Chris@82 120 alignment). It might seem that this should always be equal to
Chris@82 121 <code>local_n0 * n1</code>, but this is <em>not</em> the case. FFTW&rsquo;s
Chris@82 122 distributed FFT algorithms require data redistributions at
Chris@82 123 intermediate stages of the transform, and in some circumstances this
Chris@82 124 may require slightly larger local storage. This is discussed in more
Chris@82 125 detail below, under <a href="Load-balancing.html#Load-balancing">Load balancing</a>.
Chris@82 126 <a name="index-fftw_005fmalloc-5"></a>
Chris@82 127 <a name="index-fftw_005falloc_005fcomplex-3"></a>
Chris@82 128 </p>
Chris@82 129
Chris@82 130 <a name="index-advanced-interface-4"></a>
Chris@82 131 <p>The advanced-interface &lsquo;<samp>local_size</samp>&rsquo; function for multidimensional
Chris@82 132 transforms returns the same three things (<code>local_n0</code>,
Chris@82 133 <code>local_0_start</code>, and the total number of elements to allocate),
Chris@82 134 but takes more inputs:
Chris@82 135 </p>
Chris@82 136 <div class="example">
Chris@82 137 <pre class="example">ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n,
Chris@82 138 ptrdiff_t howmany,
Chris@82 139 ptrdiff_t block0,
Chris@82 140 MPI_Comm comm,
Chris@82 141 ptrdiff_t *local_n0,
Chris@82 142 ptrdiff_t *local_0_start);
Chris@82 143 </pre></div>
Chris@82 144 <a name="index-fftw_005fmpi_005flocal_005fsize_005fmany"></a>
Chris@82 145
Chris@82 146 <p>The two-dimensional case above corresponds to <code>rnk = 2</code> and an
Chris@82 147 array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>.
Chris@82 148 This routine is for any <code>rnk &gt; 1</code>; one-dimensional transforms
Chris@82 149 have their own interface because they work slightly differently, as
Chris@82 150 discussed below.
Chris@82 151 </p>
Chris@82 152 <p>First, the advanced interface allows you to perform multiple
Chris@82 153 transforms at once, of interleaved data, as specified by the
Chris@82 154 <code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single
Chris@82 155 transform.)
Chris@82 156 </p>
Chris@82 157 <p>Second, here you can specify your desired block size in the <code>n0</code>
Chris@82 158 dimension, <code>block0</code>. To use FFTW&rsquo;s default block size, pass
Chris@82 159 <code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on
Chris@82 160 <code>P</code> processes, FFTW will return <code>local_n0</code> equal to
Chris@82 161 <code>block0</code> on the first <code>P / block0</code> processes (rounded down),
Chris@82 162 return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on
Chris@82 163 the next process, and <code>local_n0</code> equal to zero on any remaining
Chris@82 164 processes. In general, we recommend using the default block size
Chris@82 165 (which corresponds to <code>n0 / P</code>, rounded up).
Chris@82 166 <a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK"></a>
Chris@82 167 <a name="index-block-distribution-1"></a>
Chris@82 168 </p>
Chris@82 169
Chris@82 170 <p>For example, suppose you have <code>P = 4</code> processes and <code>n0 =
Chris@82 171 21</code>. The default will be a block size of <code>6</code>, which will give
Chris@82 172 <code>local_n0 = 6</code> on the first three processes and <code>local_n0 =
Chris@82 173 3</code> on the last process. Instead, however, you could specify
Chris@82 174 <code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code>
Chris@82 175 on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice,
Chris@82 176 while it may look superficially more &ldquo;balanced,&rdquo; has the same
Chris@82 177 critical path as FFTW&rsquo;s default but requires more communications.)
Chris@82 178 </p>
Chris@82 179 <hr>
Chris@82 180 <div class="header">
Chris@82 181 <p>
Chris@82 182 Next: <a href="Load-balancing.html#Load-balancing" accesskey="n" rel="next">Load balancing</a>, Previous: <a href="MPI-Data-Distribution.html#MPI-Data-Distribution" accesskey="p" rel="prev">MPI Data Distribution</a>, Up: <a href="MPI-Data-Distribution.html#MPI-Data-Distribution" accesskey="u" rel="up">MPI Data Distribution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
Chris@82 183 </div>
Chris@82 184
Chris@82 185
Chris@82 186
Chris@82 187 </body>
Chris@82 188 </html>