Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:22

0001 /*
0002  * Copyright (c) 2003, 2007-14 Matteo Frigo
0003  * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
0004  *
0005  * The following statement of license applies *only* to this header file,
0006  * and *not* to the other files distributed with FFTW or derived therefrom:
0007  * 
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions
0010  * are met:
0011  *
0012  * 1. Redistributions of source code must retain the above copyright
0013  *    notice, this list of conditions and the following disclaimer.
0014  *
0015  * 2. Redistributions in binary form must reproduce the above copyright
0016  *    notice, this list of conditions and the following disclaimer in the
0017  *    documentation and/or other materials provided with the distribution.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
0020  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0022  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
0023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
0025  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0027  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0030  */
0031 
0032 /***************************** NOTE TO USERS *********************************
0033  *
0034  *                 THIS IS A HEADER FILE, NOT A MANUAL
0035  *
0036  *    If you want to know how to use FFTW, please read the manual,
0037  *    online at http://www.fftw.org/doc/ and also included with FFTW.
0038  *    For a quick start, see the manual's tutorial section.
0039  *
0040  *   (Reading header files to learn how to use a library is a habit
0041  *    stemming from code lacking a proper manual.  Arguably, it's a
0042  *    *bad* habit in most cases, because header files can contain
0043  *    interfaces that are not part of the public, stable API.)
0044  *
0045  ****************************************************************************/
0046 
0047 #ifndef FFTW3_MPI_H
0048 #define FFTW3_MPI_H
0049 
0050 #include <fftw3.h>
0051 #include <mpi.h>
0052 
0053 #ifdef __cplusplus
0054 extern "C"
0055 {
0056 #endif /* __cplusplus */
0057 
0058 struct fftw_mpi_ddim_do_not_use_me {
0059      ptrdiff_t n;                     /* dimension size */
0060      ptrdiff_t ib;                    /* input block */
0061      ptrdiff_t ob;                    /* output block */
0062 };
0063 
0064 /*
0065   huge second-order macro that defines prototypes for all API
0066   functions.  We expand this macro for each supported precision
0067  
0068   XM: name-mangling macro (MPI)
0069   X: name-mangling macro (serial)
0070   R: real data type
0071   C: complex data type
0072 */
0073 
0074 #define FFTW_MPI_DEFINE_API(XM, X, R, C)            \
0075                                 \
0076 typedef struct fftw_mpi_ddim_do_not_use_me XM(ddim);        \
0077                                 \
0078 FFTW_EXTERN void XM(init)(void);                \
0079 FFTW_EXTERN void XM(cleanup)(void);             \
0080                                 \
0081 FFTW_EXTERN ptrdiff_t XM(local_size_many_transposed)        \
0082      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0083       ptrdiff_t block0, ptrdiff_t block1, MPI_Comm comm,    \
0084       ptrdiff_t *local_n0, ptrdiff_t *local_0_start,        \
0085       ptrdiff_t *local_n1, ptrdiff_t *local_1_start);       \
0086 FFTW_EXTERN ptrdiff_t XM(local_size_many)           \
0087      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0088       ptrdiff_t block0, MPI_Comm comm,              \
0089       ptrdiff_t *local_n0, ptrdiff_t *local_0_start);       \
0090 FFTW_EXTERN ptrdiff_t XM(local_size_transposed)         \
0091      (int rnk, const ptrdiff_t *n, MPI_Comm comm,       \
0092       ptrdiff_t *local_n0, ptrdiff_t *local_0_start,        \
0093       ptrdiff_t *local_n1, ptrdiff_t *local_1_start);       \
0094 FFTW_EXTERN ptrdiff_t XM(local_size)                \
0095      (int rnk, const ptrdiff_t *n, MPI_Comm comm,       \
0096       ptrdiff_t *local_n0, ptrdiff_t *local_0_start);       \
0097 FFTW_EXTERN ptrdiff_t XM(local_size_many_1d)(           \
0098      ptrdiff_t n0, ptrdiff_t howmany,               \
0099      MPI_Comm comm, int sign, unsigned flags,           \
0100      ptrdiff_t *local_ni, ptrdiff_t *local_i_start,     \
0101      ptrdiff_t *local_no, ptrdiff_t *local_o_start);        \
0102 FFTW_EXTERN ptrdiff_t XM(local_size_1d)(            \
0103      ptrdiff_t n0, MPI_Comm comm, int sign, unsigned flags, \
0104      ptrdiff_t *local_ni, ptrdiff_t *local_i_start,     \
0105      ptrdiff_t *local_no, ptrdiff_t *local_o_start);        \
0106 FFTW_EXTERN ptrdiff_t XM(local_size_2d)(            \
0107      ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,         \
0108      ptrdiff_t *local_n0, ptrdiff_t *local_0_start);        \
0109 FFTW_EXTERN ptrdiff_t XM(local_size_2d_transposed)(     \
0110      ptrdiff_t n0, ptrdiff_t n1, MPI_Comm comm,         \
0111      ptrdiff_t *local_n0, ptrdiff_t *local_0_start,     \
0112      ptrdiff_t *local_n1, ptrdiff_t *local_1_start);        \
0113 FFTW_EXTERN ptrdiff_t XM(local_size_3d)(            \
0114      ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, MPI_Comm comm,   \
0115      ptrdiff_t *local_n0, ptrdiff_t *local_0_start);        \
0116 FFTW_EXTERN ptrdiff_t XM(local_size_3d_transposed)(     \
0117      ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, MPI_Comm comm,   \
0118      ptrdiff_t *local_n0, ptrdiff_t *local_0_start,     \
0119      ptrdiff_t *local_n1, ptrdiff_t *local_1_start);        \
0120                                 \
0121 FFTW_EXTERN X(plan) XM(plan_many_transpose)         \
0122      (ptrdiff_t n0, ptrdiff_t n1,               \
0123       ptrdiff_t howmany, ptrdiff_t block0, ptrdiff_t block1,    \
0124       R *in, R *out, MPI_Comm comm, unsigned flags);        \
0125 FFTW_EXTERN X(plan) XM(plan_transpose)              \
0126      (ptrdiff_t n0, ptrdiff_t n1,               \
0127       R *in, R *out, MPI_Comm comm, unsigned flags);        \
0128                                 \
0129 FFTW_EXTERN X(plan) XM(plan_many_dft)               \
0130      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0131       ptrdiff_t block, ptrdiff_t tblock, C *in, C *out,     \
0132       MPI_Comm comm, int sign, unsigned flags);         \
0133 FFTW_EXTERN X(plan) XM(plan_dft)                \
0134      (int rnk, const ptrdiff_t *n, C *in, C *out,       \
0135       MPI_Comm comm, int sign, unsigned flags);         \
0136 FFTW_EXTERN X(plan) XM(plan_dft_1d)             \
0137      (ptrdiff_t n0, C *in, C *out,              \
0138       MPI_Comm comm, int sign, unsigned flags);         \
0139 FFTW_EXTERN X(plan) XM(plan_dft_2d)             \
0140      (ptrdiff_t n0, ptrdiff_t n1, C *in, C *out,        \
0141       MPI_Comm comm, int sign, unsigned flags);         \
0142 FFTW_EXTERN X(plan) XM(plan_dft_3d)             \
0143      (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, C *in, C *out,  \
0144       MPI_Comm comm, int sign, unsigned flags);         \
0145                                 \
0146 FFTW_EXTERN X(plan) XM(plan_many_r2r)               \
0147      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0148       ptrdiff_t iblock, ptrdiff_t oblock, R *in, R *out,    \
0149       MPI_Comm comm, const X(r2r_kind) *kind, unsigned flags);  \
0150 FFTW_EXTERN X(plan) XM(plan_r2r)                \
0151      (int rnk, const ptrdiff_t *n, R *in, R *out,       \
0152       MPI_Comm comm, const X(r2r_kind) *kind, unsigned flags);  \
0153 FFTW_EXTERN X(plan) XM(plan_r2r_2d)             \
0154      (ptrdiff_t n0, ptrdiff_t n1, R *in, R *out, MPI_Comm comm, \
0155       X(r2r_kind) kind0, X(r2r_kind) kind1, unsigned flags);    \
0156 FFTW_EXTERN X(plan) XM(plan_r2r_3d)             \
0157      (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2,         \
0158       R *in, R *out, MPI_Comm comm, X(r2r_kind) kind0,      \
0159       X(r2r_kind) kind1, X(r2r_kind) kind2, unsigned flags);    \
0160                                 \
0161 FFTW_EXTERN X(plan) XM(plan_many_dft_r2c)           \
0162      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0163       ptrdiff_t iblock, ptrdiff_t oblock, R *in, C *out,    \
0164       MPI_Comm comm, unsigned flags);               \
0165 FFTW_EXTERN X(plan) XM(plan_dft_r2c)                \
0166      (int rnk, const ptrdiff_t *n, R *in, C *out,       \
0167       MPI_Comm comm, unsigned flags);               \
0168 FFTW_EXTERN X(plan) XM(plan_dft_r2c_2d)             \
0169      (ptrdiff_t n0, ptrdiff_t n1, R *in, C *out,        \
0170       MPI_Comm comm, unsigned flags);               \
0171 FFTW_EXTERN X(plan) XM(plan_dft_r2c_3d)             \
0172      (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, R *in, C *out,  \
0173       MPI_Comm comm, unsigned flags);               \
0174                                 \
0175 FFTW_EXTERN X(plan) XM(plan_many_dft_c2r)           \
0176      (int rnk, const ptrdiff_t *n, ptrdiff_t howmany,       \
0177       ptrdiff_t iblock, ptrdiff_t oblock, C *in, R *out,    \
0178       MPI_Comm comm, unsigned flags);               \
0179 FFTW_EXTERN X(plan) XM(plan_dft_c2r)                \
0180      (int rnk, const ptrdiff_t *n, C *in, R *out,       \
0181       MPI_Comm comm, unsigned flags);               \
0182 FFTW_EXTERN X(plan) XM(plan_dft_c2r_2d)             \
0183      (ptrdiff_t n0, ptrdiff_t n1, C *in, R *out,        \
0184       MPI_Comm comm, unsigned flags);               \
0185 FFTW_EXTERN X(plan) XM(plan_dft_c2r_3d)             \
0186      (ptrdiff_t n0, ptrdiff_t n1, ptrdiff_t n2, C *in, R *out,  \
0187       MPI_Comm comm, unsigned flags);               \
0188                                 \
0189 FFTW_EXTERN void XM(gather_wisdom)(MPI_Comm comm_);     \
0190 FFTW_EXTERN void XM(broadcast_wisdom)(MPI_Comm comm_);          \
0191                                 \
0192 FFTW_EXTERN void XM(execute_dft)(X(plan) p, C *in, C *out); \
0193 FFTW_EXTERN void XM(execute_dft_r2c)(X(plan) p, R *in, C *out); \
0194 FFTW_EXTERN void XM(execute_dft_c2r)(X(plan) p, C *in, R *out); \
0195 FFTW_EXTERN void XM(execute_r2r)(X(plan) p, R *in, R *out); 
0196 
0197 
0198 
0199 /* end of FFTW_MPI_DEFINE_API macro */
0200 
0201 #define FFTW_MPI_MANGLE_DOUBLE(name) FFTW_MANGLE_DOUBLE(FFTW_CONCAT(mpi_,name))
0202 #define FFTW_MPI_MANGLE_FLOAT(name) FFTW_MANGLE_FLOAT(FFTW_CONCAT(mpi_,name))
0203 #define FFTW_MPI_MANGLE_LONG_DOUBLE(name) FFTW_MANGLE_LONG_DOUBLE(FFTW_CONCAT(mpi_,name))
0204 
0205 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_DOUBLE, FFTW_MANGLE_DOUBLE, double, fftw_complex)
0206 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_FLOAT, FFTW_MANGLE_FLOAT, float, fftwf_complex)
0207 FFTW_MPI_DEFINE_API(FFTW_MPI_MANGLE_LONG_DOUBLE, FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
0208 
0209 #define FFTW_MPI_DEFAULT_BLOCK (0)
0210 
0211 /* MPI-specific flags */
0212 #define FFTW_MPI_SCRAMBLED_IN (1U << 27)
0213 #define FFTW_MPI_SCRAMBLED_OUT (1U << 28)
0214 #define FFTW_MPI_TRANSPOSED_IN (1U << 29)
0215 #define FFTW_MPI_TRANSPOSED_OUT (1U << 30)
0216 
0217 #ifdef __cplusplus
0218 }  /* extern "C" */
0219 #endif /* __cplusplus */
0220 
0221 #endif /* FFTW3_MPI_H */