Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.3/mpi/fftw3-mpi.h @ 10:37bf6b4a2645
Add FFTW3
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2013 15:35:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:c0fb53affa76 | 10:37bf6b4a2645 |
---|---|
1 /* | |
2 * Copyright (c) 2003, 2007-11 Matteo Frigo | |
3 * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology | |
4 * | |
5 * The following statement of license applies *only* to this header file, | |
6 * and *not* to the other files distributed with FFTW or derived therefrom: | |
7 * | |
8 * Redistribution and use in source and binary forms, with or without | |
9 * modification, are permitted provided that the following conditions | |
10 * are met: | |
11 * | |
12 * 1. Redistributions of source code must retain the above copyright | |
13 * notice, this list of conditions and the following disclaimer. | |
14 * | |
15 * 2. Redistributions in binary form must reproduce the above copyright | |
16 * notice, this list of conditions and the following disclaimer in the | |
17 * documentation and/or other materials provided with the distribution. | |
18 * | |
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 */ | |
31 | |
32 /***************************** NOTE TO USERS ********************************* | |
33 * | |
34 * THIS IS A HEADER FILE, NOT A MANUAL | |
35 * | |
36 * If you want to know how to use FFTW, please read the manual, | |
37 * online at http://www.fftw.org/doc/ and also included with FFTW. | |
38 * For a quick start, see the manual's tutorial section. | |
39 * | |
40 * (Reading header files to learn how to use a library is a habit | |
41 * stemming from code lacking a proper manual. Arguably, it's a | |
42 * *bad* habit in most cases, because header files can contain | |
43 * interfaces that are not part of the public, stable API.) | |
44 * | |
45 ****************************************************************************/ | |
46 | |
47 #ifndef FFTW3_MPI_H | |
48 #define FFTW3_MPI_H | |
49 | |
50 #include "fftw3.h" | |
51 #include <mpi.h> | |
52 | |
53 #ifdef __cplusplus | |
54 extern "C" | |
55 { | |
56 #endif /* __cplusplus */ | |
57 | |
58 struct fftw_mpi_ddim_do_not_use_me { | |
59 ptrdiff_t n; /* dimension size */ | |
60 ptrdiff_t ib; /* input block */ | |
61 ptrdiff_t ob; /* output block */ | |
62 }; | |
63 | |
64 /* | |
65 huge second-order macro that defines prototypes for all API | |
66 functions. We expand this macro for each supported precision | |
67 | |
68 XM: name-mangling macro (MPI) | |
69 X: name-mangling macro (serial) | |
70 R: real data type | |
71 C: complex data type | |
72 */ | |
73 | |
74 #define FFTW_MPI_DEFINE_API(XM, X, R, C) \ | |
75 \ | |
76 typedef struct fftw_mpi_ddim_do_not_use_me XM(ddim); \ | |
77 \ | |
78 FFTW_EXTERN void XM(init)(void); \ | |
79 FFTW_EXTERN void XM(cleanup)(void); \ | |
80 \ | |
81 FFTW_EXTERN ptrdiff_t XM(local_size_many_transposed) \ | |
82 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
83 ptrdiff_t block0, ptrdiff_t block1, MPI_Comm comm, \ | |
84 ptrdiff_t *local_n0, ptrdiff_t *local_0_start, \ | |
85 ptrdiff_t *local_n1, ptrdiff_t *local_1_start); \ | |
86 FFTW_EXTERN ptrdiff_t XM(local_size_many) \ | |
87 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
88 ptrdiff_t block0, MPI_Comm comm, \ | |
89 ptrdiff_t *local_n0, ptrdiff_t *local_0_start); \ | |
90 FFTW_EXTERN ptrdiff_t XM(local_size_transposed) \ | |
91 (int rnk, const ptrdiff_t *n, MPI_Comm comm, \ | |
92 ptrdiff_t *local_n0, ptrdiff_t *local_0_start, \ | |
93 ptrdiff_t *local_n1, ptrdiff_t *local_1_start); \ | |
94 FFTW_EXTERN ptrdiff_t XM(local_size) \ | |
95 (int rnk, const ptrdiff_t *n, MPI_Comm comm, \ | |
96 ptrdiff_t *local_n0, ptrdiff_t *local_0_start); \ | |
97 FFTW_EXTERN ptrdiff_t XM(local_size_many_1d)( \ | |
98 ptrdiff_t n0, ptrdiff_t howmany, \ | |
99 MPI_Comm comm, int sign, unsigned flags, \ | |
100 ptrdiff_t *local_ni, ptrdiff_t *local_i_start, \ | |
101 ptrdiff_t *local_no, ptrdiff_t *local_o_start); \ | |
102 FFTW_EXTERN ptrdiff_t XM(local_size_1d)( \ | |
103 ptrdiff_t n0, MPI_Comm comm, int sign, unsigned flags, \ | |
104 ptrdiff_t *local_ni, ptrdiff_t *local_i_start, \ | |
105 ptrdiff_t *local_no, ptrdiff_t *local_o_start); \ | |
106 FFTW_EXTERN ptrdiff_t XM(local_size_2d)( \ | |
107 ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm, \ | |
108 ptrdiff_t *local_n0, ptrdiff_t *local_0_start); \ | |
109 FFTW_EXTERN ptrdiff_t XM(local_size_2d_transposed)( \ | |
110 ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm, \ | |
111 ptrdiff_t *local_n0, ptrdiff_t *local_0_start, \ | |
112 ptrdiff_t *local_n1, ptrdiff_t *local_1_start); \ | |
113 FFTW_EXTERN ptrdiff_t XM(local_size_3d)( \ | |
114 ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, MPI_Comm comm, \ | |
115 ptrdiff_t *local_n0, ptrdiff_t *local_0_start); \ | |
116 FFTW_EXTERN ptrdiff_t XM(local_size_3d_transposed)( \ | |
117 ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, MPI_Comm comm, \ | |
118 ptrdiff_t *local_n0, ptrdiff_t *local_0_start, \ | |
119 ptrdiff_t *local_n1, ptrdiff_t *local_1_start); \ | |
120 \ | |
121 FFTW_EXTERN X(plan) XM(plan_many_transpose) \ | |
122 (ptrdiff_t n0, ptrdiff_t n1, \ | |
123 ptrdiff_t howmany, ptrdiff_t block0, ptrdiff_t block1, \ | |
124 R *in, R *out, MPI_Comm comm, unsigned flags); \ | |
125 FFTW_EXTERN X(plan) XM(plan_transpose) \ | |
126 (ptrdiff_t n0, ptrdiff_t n1, \ | |
127 R *in, R *out, MPI_Comm comm, unsigned flags); \ | |
128 \ | |
129 FFTW_EXTERN X(plan) XM(plan_many_dft) \ | |
130 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
131 ptrdiff_t block, ptrdiff_t tblock, C *in, C *out, \ | |
132 MPI_Comm comm, int sign, unsigned flags); \ | |
133 FFTW_EXTERN X(plan) XM(plan_dft) \ | |
134 (int rnk, const ptrdiff_t *n, C *in, C *out, \ | |
135 MPI_Comm comm, int sign, unsigned flags); \ | |
136 FFTW_EXTERN X(plan) XM(plan_dft_1d) \ | |
137 (ptrdiff_t n0, C *in, C *out, \ | |
138 MPI_Comm comm, int sign, unsigned flags); \ | |
139 FFTW_EXTERN X(plan) XM(plan_dft_2d) \ | |
140 (ptrdiff_t n0, ptrdiff_t n1, C *in, C *out, \ | |
141 MPI_Comm comm, int sign, unsigned flags); \ | |
142 FFTW_EXTERN X(plan) XM(plan_dft_3d) \ | |
143 (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, C *in, C *out, \ | |
144 MPI_Comm comm, int sign, unsigned flags); \ | |
145 \ | |
146 FFTW_EXTERN X(plan) XM(plan_many_r2r) \ | |
147 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
148 ptrdiff_t iblock, ptrdiff_t oblock, R *in, R *out, \ | |
149 MPI_Comm comm, const X(r2r_kind) *kind, unsigned flags); \ | |
150 FFTW_EXTERN X(plan) XM(plan_r2r) \ | |
151 (int rnk, const ptrdiff_t *n, R *in, R *out, \ | |
152 MPI_Comm comm, const X(r2r_kind) *kind, unsigned flags); \ | |
153 FFTW_EXTERN X(plan) XM(plan_r2r_2d) \ | |
154 (ptrdiff_t n0, ptrdiff_t n1, R *in, R *out, MPI_Comm comm, \ | |
155 X(r2r_kind) kind0, X(r2r_kind) kind1, unsigned flags); \ | |
156 FFTW_EXTERN X(plan) XM(plan_r2r_3d) \ | |
157 (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, \ | |
158 R *in, R *out, MPI_Comm comm, X(r2r_kind) kind0, \ | |
159 X(r2r_kind) kind1, X(r2r_kind) kind2, unsigned flags); \ | |
160 \ | |
161 FFTW_EXTERN X(plan) XM(plan_many_dft_r2c) \ | |
162 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
163 ptrdiff_t iblock, ptrdiff_t oblock, R *in, C *out, \ | |
164 MPI_Comm comm, unsigned flags); \ | |
165 FFTW_EXTERN X(plan) XM(plan_dft_r2c) \ | |
166 (int rnk, const ptrdiff_t *n, R *in, C *out, \ | |
167 MPI_Comm comm, unsigned flags); \ | |
168 FFTW_EXTERN X(plan) XM(plan_dft_r2c_2d) \ | |
169 (ptrdiff_t n0, ptrdiff_t n1, R *in, C *out, \ | |
170 MPI_Comm comm, unsigned flags); \ | |
171 FFTW_EXTERN X(plan) XM(plan_dft_r2c_3d) \ | |
172 (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, R *in, C *out, \ | |
173 MPI_Comm comm, unsigned flags); \ | |
174 \ | |
175 FFTW_EXTERN X(plan) XM(plan_many_dft_c2r) \ | |
176 (int rnk, const ptrdiff_t *n, ptrdiff_t howmany, \ | |
177 ptrdiff_t iblock, ptrdiff_t oblock, C *in, R *out, \ | |
178 MPI_Comm comm, unsigned flags); \ | |
179 FFTW_EXTERN X(plan) XM(plan_dft_c2r) \ | |
180 (int rnk, const ptrdiff_t *n, C *in, R *out, \ | |
181 MPI_Comm comm, unsigned flags); \ | |
182 FFTW_EXTERN X(plan) XM(plan_dft_c2r_2d) \ | |
183 (ptrdiff_t n0, ptrdiff_t n1, C *in, R *out, \ | |
184 MPI_Comm comm, unsigned flags); \ | |
185 FFTW_EXTERN X(plan) XM(plan_dft_c2r_3d) \ | |
186 (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, C *in, R *out, \ | |
187 MPI_Comm comm, unsigned flags); \ | |
188 \ | |
189 FFTW_EXTERN void XM(gather_wisdom)(MPI_Comm comm_); \ | |
190 FFTW_EXTERN void XM(broadcast_wisdom)(MPI_Comm comm_); \ | |
191 \ | |
192 FFTW_EXTERN void XM(execute_dft)(X(plan) p, C *in, C *out); \ | |
193 FFTW_EXTERN void XM(execute_dft_r2c)(X(plan) p, R *in, C *out); \ | |
194 FFTW_EXTERN void XM(execute_dft_c2r)(X(plan) p, C *in, R *out); \ | |
195 FFTW_EXTERN void XM(execute_r2r)(X(plan) p, R *in, R *out); | |
196 | |
197 | |
198 | |
199 /* end of FFTW_MPI_DEFINE_API macro */ | |
200 | |
201 #define FFTW_MPI_MANGLE_DOUBLE(name) FFTW_MANGLE_DOUBLE(FFTW_CONCAT(mpi_,name)) | |
202 #define FFTW_MPI_MANGLE_FLOAT(name) FFTW_MANGLE_FLOAT(FFTW_CONCAT(mpi_,name)) | |
203 #define FFTW_MPI_MANGLE_LONG_DOUBLE(name) FFTW_MANGLE_LONG_DOUBLE(FFTW_CONCAT(mpi_,name)) | |
204 | |
205 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_DOUBLE, FFTW_MANGLE_DOUBLE, double, fftw_complex) | |
206 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_FLOAT, FFTW_MANGLE_FLOAT, float, fftwf_complex) | |
207 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_LONG_DOUBLE, FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex) | |
208 | |
209 #define FFTW_MPI_DEFAULT_BLOCK (0) | |
210 | |
211 /* MPI-specific flags */ | |
212 #define FFTW_MPI_SCRAMBLED_IN (1U << 27) | |
213 #define FFTW_MPI_SCRAMBLED_OUT (1U << 28) | |
214 #define FFTW_MPI_TRANSPOSED_IN (1U << 29) | |
215 #define FFTW_MPI_TRANSPOSED_OUT (1U << 30) | |
216 | |
217 #ifdef __cplusplus | |
218 } /* extern "C" */ | |
219 #endif /* __cplusplus */ | |
220 | |
221 #endif /* FFTW3_MPI_H */ |