annotate src/fftw-3.3.5/doc/html/Basic-and-advanced-distribution-interfaces.html @ 169:223a55898ab9 tip default

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