Mercurial > hg > sv-dependency-builds
comparison 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 |
comparison
equal
deleted
inserted
replaced
94:d278df1123f9 | 95:89f5e221ed7b |
---|---|
1 <html lang="en"> | |
2 <head> | |
3 <title>Basic and advanced distribution interfaces - FFTW 3.3.3</title> | |
4 <meta http-equiv="Content-Type" content="text/html"> | |
5 <meta name="description" content="FFTW 3.3.3"> | |
6 <meta name="generator" content="makeinfo 4.13"> | |
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.3.3, 25 November 2012). | |
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 <a name="Basic-and-advanced-distribution-interfaces"></a> | |
50 <p> | |
51 Next: <a rel="next" accesskey="n" href="Load-balancing.html#Load-balancing">Load balancing</a>, | |
52 Previous: <a rel="previous" accesskey="p" href="MPI-Data-Distribution.html#MPI-Data-Distribution">MPI Data Distribution</a>, | |
53 Up: <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 × 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-370"></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-371"></a> | |
90 | |
91 <p>Second, the return value is the total number of data elements (e.g., | |
92 complex numbers for a complex DFT) that should be allocated for the | |
93 input and output arrays on the current process (ideally with | |
94 <code>fftw_malloc</code> or an ‘<samp><span class="samp">fftw_alloc</span></samp>’ function, to ensure optimal | |
95 alignment). It might seem that this should always be equal to | |
96 <code>local_n0 * n1</code>, but this is <em>not</em> the case. FFTW's | |
97 distributed FFT algorithms require data redistributions at | |
98 intermediate stages of the transform, and in some circumstances this | |
99 may require slightly larger local storage. This is discussed in more | |
100 detail below, under <a href="Load-balancing.html#Load-balancing">Load balancing</a>. | |
101 <a name="index-fftw_005fmalloc-372"></a><a name="index-fftw_005falloc_005fcomplex-373"></a> | |
102 | |
103 <p><a name="index-advanced-interface-374"></a>The advanced-interface ‘<samp><span class="samp">local_size</span></samp>’ function for multidimensional | |
104 transforms returns the same three things (<code>local_n0</code>, | |
105 <code>local_0_start</code>, and the total number of elements to allocate), | |
106 but takes more inputs: | |
107 | |
108 <pre class="example"> ptrdiff_t fftw_mpi_local_size_many(int rnk, const ptrdiff_t *n, | |
109 ptrdiff_t howmany, | |
110 ptrdiff_t block0, | |
111 MPI_Comm comm, | |
112 ptrdiff_t *local_n0, | |
113 ptrdiff_t *local_0_start); | |
114 </pre> | |
115 <p><a name="index-fftw_005fmpi_005flocal_005fsize_005fmany-375"></a> | |
116 The two-dimensional case above corresponds to <code>rnk = 2</code> and an | |
117 array <code>n</code> of length 2 with <code>n[0] = n0</code> and <code>n[1] = n1</code>. | |
118 This routine is for any <code>rnk > 1</code>; one-dimensional transforms | |
119 have their own interface because they work slightly differently, as | |
120 discussed below. | |
121 | |
122 <p>First, the advanced interface allows you to perform multiple | |
123 transforms at once, of interleaved data, as specified by the | |
124 <code>howmany</code> parameter. (<code>hoamany</code> is 1 for a single | |
125 transform.) | |
126 | |
127 <p>Second, here you can specify your desired block size in the <code>n0</code> | |
128 dimension, <code>block0</code>. To use FFTW's default block size, pass | |
129 <code>FFTW_MPI_DEFAULT_BLOCK</code> (0) for <code>block0</code>. Otherwise, on | |
130 <code>P</code> processes, FFTW will return <code>local_n0</code> equal to | |
131 <code>block0</code> on the first <code>P / block0</code> processes (rounded down), | |
132 return <code>local_n0</code> equal to <code>n0 - block0 * (P / block0)</code> on | |
133 the next process, and <code>local_n0</code> equal to zero on any remaining | |
134 processes. In general, we recommend using the default block size | |
135 (which corresponds to <code>n0 / P</code>, rounded up). | |
136 <a name="index-FFTW_005fMPI_005fDEFAULT_005fBLOCK-376"></a><a name="index-block-distribution-377"></a> | |
137 | |
138 <p>For example, suppose you have <code>P = 4</code> processes and <code>n0 = | |
139 21</code>. The default will be a block size of <code>6</code>, which will give | |
140 <code>local_n0 = 6</code> on the first three processes and <code>local_n0 = | |
141 3</code> on the last process. Instead, however, you could specify | |
142 <code>block0 = 5</code> if you wanted, which would give <code>local_n0 = 5</code> | |
143 on processes 0 to 2, <code>local_n0 = 6</code> on process 3. (This choice, | |
144 while it may look superficially more “balanced,” has the same | |
145 critical path as FFTW's default but requires more communications.) | |
146 | |
147 </body></html> | |
148 |