annotate src/fftw-3.3.8/doc/html/Basic-and-advanced-distribution-interfaces.html @ 167:bd3cc4d1df30

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