diff src/fftw-3.3.3/doc/html/Basic-and-advanced-distribution-interfaces.html @ 95:89f5e221ed7b

Add FFTW3
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 15:35:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/fftw-3.3.3/doc/html/Basic-and-advanced-distribution-interfaces.html	Wed Mar 20 15:35:50 2013 +0000
@@ -0,0 +1,148 @@
+<html lang="en">
+<head>
+<title>Basic and advanced distribution interfaces - FFTW 3.3.3</title>
+<meta http-equiv="Content-Type" content="text/html">
+<meta name="description" content="FFTW 3.3.3">
+<meta name="generator" content="makeinfo 4.13">
+<link title="Top" rel="start" href="index.html#Top">
+<link rel="up" href="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
+<link rel="prev" href="MPI-Data-Distribution.html#MPI-Data-Distribution" title="MPI Data Distribution">
+<link rel="next" href="Load-balancing.html#Load-balancing" title="Load balancing">
+<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
+<!--
+This manual is for FFTW
+(version 3.3.3, 25 November 2012).
+
+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.
+   -->
+<meta http-equiv="Content-Style-Type" content="text/css">
+<style type="text/css"><!--
+  pre.display { font-family:inherit }
+  pre.format  { font-family:inherit }
+  pre.smalldisplay { font-family:inherit; font-size:smaller }
+  pre.smallformat  { font-family:inherit; font-size:smaller }
+  pre.smallexample { font-size:smaller }
+  pre.smalllisp    { font-size:smaller }
+  span.sc    { font-variant:small-caps }
+  span.roman { font-family:serif; font-weight:normal; } 
+  span.sansserif { font-family:sans-serif; font-weight:normal; } 
+--></style>
+</head>
+<body>
+<div class="node">
+<a name="Basic-and-advanced-distribution-interfaces"></a>
+<p>
+Next:&nbsp;<a rel="next" accesskey="n" href="Load-balancing.html#Load-balancing">Load balancing</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>
+<hr>
+</div>
+
+<h4 class="subsection">6.4.1 Basic and advanced distribution interfaces</h4>
+
+<p>As with the planner interface, the &lsquo;<samp><span class="samp">fftw_mpi_local_size</span></samp>&rsquo;
+distribution interface is broken into basic and advanced
+(&lsquo;<samp><span class="samp">_many</span></samp>&rsquo;) 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>For the 100&nbsp;&times;&nbsp;200 complex-DFT example, above, we would find
+the distribution by calling the following function in the basic
+interface:
+
+<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>
+   <p><a name="index-fftw_005fmpi_005flocal_005fsize_005f2d-370"></a>
+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>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_002dmajor-Format">Row-major Format</a>. 
+<a name="index-row_002dmajor-371"></a>
+
+   <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 &lsquo;<samp><span class="samp">fftw_alloc</span></samp>&rsquo; 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">Load balancing</a>. 
+<a name="index-fftw_005fmalloc-372"></a><a name="index-fftw_005falloc_005fcomplex-373"></a>
+
+   <p><a name="index-advanced-interface-374"></a>The advanced-interface &lsquo;<samp><span class="samp">local_size</span></samp>&rsquo; 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:
+
+<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>
+   <p><a name="index-fftw_005fmpi_005flocal_005fsize_005fmany-375"></a>
+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 &gt; 1</code>; one-dimensional transforms
+have their own interface because they work slightly differently, as
+discussed below.
+
+   <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>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). 
+<a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK-376"></a><a name="index-block-distribution-377"></a>
+
+   <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 &ldquo;balanced,&rdquo; has the same
+critical path as FFTW's default but requires more communications.)
+
+   </body></html>
+