comparison Lib/fftw-3.2.1/doc/html/.svn/text-base/Basic-and-advanced-distribution-interfaces.html.svn-base @ 0:25bf17994ef1

First commit. VS2013, Codeblocks and Mac OSX configuration
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Thu, 09 Jul 2015 01:12:16 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:25bf17994ef1
1 <html lang="en">
2 <head>
3 <title>Basic and advanced distribution interfaces - FFTW 3.2alpha3</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="FFTW 3.2alpha3">
6 <meta name="generator" content="makeinfo 4.8">
7 <link title="Top" rel="start" href="index.html#Top">
8 <link rel="up" href="MPI-data-distribution.html#MPI-data-distribution" title="MPI data distribution">
9 <link rel="prev" href="MPI-data-distribution.html#MPI-data-distribution" title="MPI data distribution">
10 <link rel="next" href="Load-balancing.html#Load-balancing" title="Load balancing">
11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12 <!--
13 This manual is for FFTW
14 (version 3.2alpha3, 14 August 2007).
15
16 Copyright (C) 2003 Matteo Frigo.
17
18 Copyright (C) 2003 Massachusetts Institute of Technology.
19
20 Permission is granted to make and distribute verbatim copies of
21 this manual provided the copyright notice and this permission
22 notice are preserved on all copies.
23
24 Permission is granted to copy and distribute modified versions of
25 this manual under the conditions for verbatim copying, provided
26 that the entire resulting derived work is distributed under the
27 terms of a permission notice identical to this one.
28
29 Permission is granted to copy and distribute translations of this
30 manual into another language, under the above conditions for
31 modified versions, except that this permission notice may be
32 stated in a translation approved by the Free Software Foundation.
33 -->
34 <meta http-equiv="Content-Style-Type" content="text/css">
35 <style type="text/css"><!--
36 pre.display { font-family:inherit }
37 pre.format { font-family:inherit }
38 pre.smalldisplay { font-family:inherit; font-size:smaller }
39 pre.smallformat { font-family:inherit; font-size:smaller }
40 pre.smallexample { font-size:smaller }
41 pre.smalllisp { font-size:smaller }
42 span.sc { font-variant:small-caps }
43 span.roman { font-family:serif; font-weight:normal; }
44 span.sansserif { font-family:sans-serif; font-weight:normal; }
45 --></style>
46 </head>
47 <body>
48 <div class="node">
49 <p>
50 <a name="Basic-and-advanced-distribution-interfaces"></a>
51 Next:&nbsp;<a rel="next" accesskey="n" href="Load-balancing.html#Load-balancing">Load balancing</a>,
52 Previous:&nbsp;<a rel="previous" accesskey="p" href="MPI-data-distribution.html#MPI-data-distribution">MPI data distribution</a>,
53 Up:&nbsp;<a rel="up" accesskey="u" href="MPI-data-distribution.html#MPI-data-distribution">MPI data distribution</a>
54 <hr>
55 </div>
56
57 <h4 class="subsection">6.4.1 Basic and advanced distribution interfaces</h4>
58
59 <p>As with the planner interface, the `<samp><span class="samp">fftw_mpi_local_size</span></samp>'
60 distribution interface is broken into basic and advanced
61 (`<samp><span class="samp">_many</span></samp>') interfaces, where the latter allows you to specify the
62 block size manually and also to request block sizes when computing
63 multiple transforms simultaneously. These functions are documented
64 more exhaustively by the FFTW MPI Reference, but we summarize the
65 basic ideas here using a couple of two-dimensional examples.
66
67 <p>For the 100&nbsp;&times;&nbsp;200 complex-DFT example, above, we would find
68 the distribution by calling the following function in the basic
69 interface:
70
71 <pre class="example"> ptrdiff_t fftw_mpi_local_size_2d(ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,
72 ptrdiff_t *local_n0, ptrdiff_t *local_0_start);
73 </pre>
74 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005f2d-352"></a>
75 Given the total size of the data to be transformed (here, <code>n0 =
76 100</code> and <code>n1 = 200</code>) and an MPI communicator (<code>comm</code>), this
77 function provides three numbers.
78
79 <p>First, it describes the shape of the local data: the current process
80 should store a <code>local_n0</code> by <code>n1</code> slice of the overall
81 dataset, in row-major order (<code>n1</code> dimension contiguous), starting
82 at index <code>local_0_start</code>. That is, if the total dataset is
83 viewed as a <code>n0</code> by <code>n1</code> matrix, the current process should
84 store the rows <code>local_0_start</code> to
85 <code>local_0_start+local_n0-1</code>. Obviously, if you are running with
86 only a single MPI process, that process will store the entire array:
87 <code>local_0_start</code> will be zero and <code>local_n0</code> will be
88 <code>n0</code>. See <a href="Row_002dmajor-Format.html#Row_002dmajor-Format">Row-major Format</a>.
89 <a name="index-row_002dmajor-353"></a>
90 Second, the return value is the total number of data elements (e.g.,
91 complex numbers for a complex DFT) that should be allocated for the
92 input and output arrays on the current process (ideally with
93 <code>fftw_malloc</code>, to ensure optimal alignment). It might seem that
94 this should always be equal to <code>local_n0 * n1</code>, but this is
95 <em>not</em> the case. FFTW's distributed FFT algorithms require data
96 redistributions at intermediate stages of the transform, and in some
97 circumstances this may require slightly larger local storage. This is
98 discussed in more detail below, under <a href="Load-balancing.html#Load-balancing">Load balancing</a>.
99 <a name="index-fftw_005fmalloc-354"></a>
100 The advanced-interface `<samp><span class="samp">local_size</span></samp>' function for multidimensional
101 transforms returns the same three things (<code>local_n0</code>,
102 <code>local_0_start</code>, and the total number of elements to allocate),
103 but takes more inputs:
104
105 <pre class="example"> ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n,
106 ptrdiff_t howmany,
107 ptrdiff_t block0,
108 MPI_Comm comm,
109 ptrdiff_t *local_n0,
110 ptrdiff_t *local_0_start);
111 </pre>
112 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005fmany-355"></a>
113 The two-dimensional case above corresponds to <code>rnk = 2</code> and an
114 array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>.
115 This routine is for any <code>rnk &gt; 1</code>; one-dimensional transforms
116 have their own interface because they work slightly differently, as
117 discussed below.
118
119 <p>First, the advanced interface allows you to perform multiple
120 transforms at once, of interleaved data, as specified by the
121 <code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single
122 transform.)
123
124 <p>Second, here you can specify your desired block size in the <code>n0</code>
125 dimension, <code>block0</code>. To use FFTW's default block size, pass
126 <code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on
127 <code>P</code> processes, FFTW will return <code>local_n0</code> equal to
128 <code>block0</code> on the first <code>P / block0</code> processes (rounded down),
129 return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on
130 the next process, and <code>local_n0</code> equal to zero on any remaining
131 processes. In general, we recommend using the default block size
132 (which corresponds to <code>n0 / P</code>, rounded up).
133 <a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK-356"></a><a name="index-block-distribution-357"></a>
134 For example, suppose you have <code>P = 4</code> processes and <code>n0 =
135 21</code>. The default will be a block size of <code>6</code>, which will give
136 <code>local_n0 = 6</code> on the first three processes and <code>local_n0 =
137 3</code> on the last process. Instead, however, you could specify
138 <code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code>
139 on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice,
140 while it may look superficially more &ldquo;balanced,&rdquo; has the same
141 critical path as FFTW's default but requires more communications.)
142
143 </body></html>
144