mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-06 04:45:05 +00:00
54e93db207
not reliable yet
177 lines
8.9 KiB
HTML
177 lines
8.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- This manual is for FFTW
|
|
(version 3.3.10, 10 December 2020).
|
|
|
|
Copyright (C) 2003 Matteo Frigo.
|
|
|
|
Copyright (C) 2003 Massachusetts Institute of Technology.
|
|
|
|
Permission is granted to make and distribute verbatim copies of this
|
|
manual provided the copyright notice and this permission notice are
|
|
preserved on all copies.
|
|
|
|
Permission is granted to copy and distribute modified versions of this
|
|
manual under the conditions for verbatim copying, provided that the
|
|
entire resulting derived work is distributed under the terms of a
|
|
permission notice identical to this one.
|
|
|
|
Permission is granted to copy and distribute translations of this manual
|
|
into another language, under the above conditions for modified versions,
|
|
except that this permission notice may be stated in a translation
|
|
approved by the Free Software Foundation. -->
|
|
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Basic and advanced distribution interfaces (FFTW 3.3.10)</title>
|
|
|
|
<meta name="description" content="Basic and advanced distribution interfaces (FFTW 3.3.10)">
|
|
<meta name="keywords" content="Basic and advanced distribution interfaces (FFTW 3.3.10)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="MPI-Data-Distribution.html" rel="up" title="MPI Data Distribution">
|
|
<link href="Load-balancing.html" rel="next" title="Load balancing">
|
|
<link href="MPI-Data-Distribution.html" rel="prev" title="MPI Data Distribution">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
kbd {font-style: oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<span id="Basic-and-advanced-distribution-interfaces"></span><div class="header">
|
|
<p>
|
|
Next: <a href="Load-balancing.html" accesskey="n" rel="next">Load balancing</a>, Previous: <a href="MPI-Data-Distribution.html" accesskey="p" rel="prev">MPI Data Distribution</a>, Up: <a href="MPI-Data-Distribution.html" accesskey="u" rel="up">MPI Data Distribution</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<span id="Basic-and-advanced-distribution-interfaces-1"></span><h4 class="subsection">6.4.1 Basic and advanced distribution interfaces</h4>
|
|
|
|
<p>As with the planner interface, the ‘<samp>fftw_mpi_local_size</samp>’
|
|
distribution interface is broken into basic and advanced
|
|
(‘<samp>_many</samp>’) interfaces, where the latter allows you to specify the
|
|
block size manually and also to request block sizes when computing
|
|
multiple transforms simultaneously. These functions are documented
|
|
more exhaustively by the FFTW MPI Reference, but we summarize the
|
|
basic ideas here using a couple of two-dimensional examples.
|
|
</p>
|
|
<p>For the 100 × 200
|
|
complex-DFT example, above, we would find
|
|
the distribution by calling the following function in the basic
|
|
interface:
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">ptrdiff_t fftw_mpi_local_size_2d(ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,
|
|
ptrdiff_t *local_n0, ptrdiff_t *local_0_start);
|
|
</pre></div>
|
|
<span id="index-fftw_005fmpi_005flocal_005fsize_005f2d-1"></span>
|
|
|
|
<p>Given the total size of the data to be transformed (here, <code>n0 =
|
|
100</code> and <code>n1 = 200</code>) and an MPI communicator (<code>comm</code>), this
|
|
function provides three numbers.
|
|
</p>
|
|
<p>First, it describes the shape of the local data: the current process
|
|
should store a <code>local_n0</code> by <code>n1</code> slice of the overall
|
|
dataset, in row-major order (<code>n1</code> dimension contiguous), starting
|
|
at index <code>local_0_start</code>. That is, if the total dataset is
|
|
viewed as a <code>n0</code> by <code>n1</code> matrix, the current process should
|
|
store the rows <code>local_0_start</code> to
|
|
<code>local_0_start+local_n0-1</code>. Obviously, if you are running with
|
|
only a single MPI process, that process will store the entire array:
|
|
<code>local_0_start</code> will be zero and <code>local_n0</code> will be
|
|
<code>n0</code>. See <a href="Row_002dmajor-Format.html">Row-major Format</a>.
|
|
<span id="index-row_002dmajor-4"></span>
|
|
</p>
|
|
|
|
<p>Second, the return value is the total number of data elements (e.g.,
|
|
complex numbers for a complex DFT) that should be allocated for the
|
|
input and output arrays on the current process (ideally with
|
|
<code>fftw_malloc</code> or an ‘<samp>fftw_alloc</samp>’ function, to ensure optimal
|
|
alignment). It might seem that this should always be equal to
|
|
<code>local_n0 * n1</code>, but this is <em>not</em> the case. FFTW’s
|
|
distributed FFT algorithms require data redistributions at
|
|
intermediate stages of the transform, and in some circumstances this
|
|
may require slightly larger local storage. This is discussed in more
|
|
detail below, under <a href="Load-balancing.html">Load balancing</a>.
|
|
<span id="index-fftw_005fmalloc-5"></span>
|
|
<span id="index-fftw_005falloc_005fcomplex-3"></span>
|
|
</p>
|
|
|
|
<span id="index-advanced-interface-4"></span>
|
|
<p>The advanced-interface ‘<samp>local_size</samp>’ function for multidimensional
|
|
transforms returns the same three things (<code>local_n0</code>,
|
|
<code>local_0_start</code>, and the total number of elements to allocate),
|
|
but takes more inputs:
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n,
|
|
ptrdiff_t howmany,
|
|
ptrdiff_t block0,
|
|
MPI_Comm comm,
|
|
ptrdiff_t *local_n0,
|
|
ptrdiff_t *local_0_start);
|
|
</pre></div>
|
|
<span id="index-fftw_005fmpi_005flocal_005fsize_005fmany"></span>
|
|
|
|
<p>The two-dimensional case above corresponds to <code>rnk = 2</code> and an
|
|
array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>.
|
|
This routine is for any <code>rnk > 1</code>; one-dimensional transforms
|
|
have their own interface because they work slightly differently, as
|
|
discussed below.
|
|
</p>
|
|
<p>First, the advanced interface allows you to perform multiple
|
|
transforms at once, of interleaved data, as specified by the
|
|
<code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single
|
|
transform.)
|
|
</p>
|
|
<p>Second, here you can specify your desired block size in the <code>n0</code>
|
|
dimension, <code>block0</code>. To use FFTW’s default block size, pass
|
|
<code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on
|
|
<code>P</code> processes, FFTW will return <code>local_n0</code> equal to
|
|
<code>block0</code> on the first <code>P / block0</code> processes (rounded down),
|
|
return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on
|
|
the next process, and <code>local_n0</code> equal to zero on any remaining
|
|
processes. In general, we recommend using the default block size
|
|
(which corresponds to <code>n0 / P</code>, rounded up).
|
|
<span id="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK"></span>
|
|
<span id="index-block-distribution-1"></span>
|
|
</p>
|
|
|
|
<p>For example, suppose you have <code>P = 4</code> processes and <code>n0 =
|
|
21</code>. The default will be a block size of <code>6</code>, which will give
|
|
<code>local_n0 = 6</code> on the first three processes and <code>local_n0 =
|
|
3</code> on the last process. Instead, however, you could specify
|
|
<code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code>
|
|
on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice,
|
|
while it may look superficially more “balanced,” has the same
|
|
critical path as FFTW’s default but requires more communications.)
|
|
</p>
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="Load-balancing.html" accesskey="n" rel="next">Load balancing</a>, Previous: <a href="MPI-Data-Distribution.html" accesskey="p" rel="prev">MPI Data Distribution</a>, Up: <a href="MPI-Data-Distribution.html" accesskey="u" rel="up">MPI Data Distribution</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|