annotate fft/fftw/fftw-3.3.4/mpi/ifftw-mpi.h @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents 26056e866c29
children
rev   line source
Chris@19 1 /*
Chris@19 2 * Copyright (c) 2003, 2007-14 Matteo Frigo
Chris@19 3 * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
Chris@19 4 *
Chris@19 5 * This program is free software; you can redistribute it and/or modify
Chris@19 6 * it under the terms of the GNU General Public License as published by
Chris@19 7 * the Free Software Foundation; either version 2 of the License, or
Chris@19 8 * (at your option) any later version.
Chris@19 9 *
Chris@19 10 * This program is distributed in the hope that it will be useful,
Chris@19 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@19 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@19 13 * GNU General Public License for more details.
Chris@19 14 *
Chris@19 15 * You should have received a copy of the GNU General Public License
Chris@19 16 * along with this program; if not, write to the Free Software
Chris@19 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Chris@19 18 *
Chris@19 19 */
Chris@19 20
Chris@19 21 /* FFTW-MPI internal header file */
Chris@19 22 #ifndef __IFFTW_MPI_H__
Chris@19 23 #define __IFFTW_MPI_H__
Chris@19 24
Chris@19 25 #include "ifftw.h"
Chris@19 26 #include "rdft.h"
Chris@19 27
Chris@19 28 #include <mpi.h>
Chris@19 29
Chris@19 30 /* mpi problem flags: problem-dependent meaning, but in general
Chris@19 31 SCRAMBLED means some reordering *within* the dimensions, while
Chris@19 32 TRANSPOSED means some reordering *of* the dimensions */
Chris@19 33 #define SCRAMBLED_IN (1 << 0)
Chris@19 34 #define SCRAMBLED_OUT (1 << 1)
Chris@19 35 #define TRANSPOSED_IN (1 << 2)
Chris@19 36 #define TRANSPOSED_OUT (1 << 3)
Chris@19 37 #define RANK1_BIGVEC_ONLY (1 << 4) /* for rank=1, allow only bigvec solver */
Chris@19 38
Chris@19 39 #define ONLY_SCRAMBLEDP(flags) (!((flags) & ~(SCRAMBLED_IN|SCRAMBLED_OUT)))
Chris@19 40 #define ONLY_TRANSPOSEDP(flags) (!((flags) & ~(TRANSPOSED_IN|TRANSPOSED_OUT)))
Chris@19 41
Chris@19 42 #if defined(FFTW_SINGLE)
Chris@19 43 # define FFTW_MPI_TYPE MPI_FLOAT
Chris@19 44 #elif defined(FFTW_LDOUBLE)
Chris@19 45 # define FFTW_MPI_TYPE MPI_LONG_DOUBLE
Chris@19 46 #elif defined(FFTW_QUAD)
Chris@19 47 # error MPI quad-precision type is unknown
Chris@19 48 #else
Chris@19 49 # define FFTW_MPI_TYPE MPI_DOUBLE
Chris@19 50 #endif
Chris@19 51
Chris@19 52 /* all fftw-mpi identifiers start with fftw_mpi (or fftwf_mpi etc.) */
Chris@19 53 #define XM(name) X(CONCAT(mpi_, name))
Chris@19 54
Chris@19 55 /***********************************************************************/
Chris@19 56 /* block distributions */
Chris@19 57
Chris@19 58 /* a distributed dimension of length n with input and output block
Chris@19 59 sizes ib and ob, respectively. */
Chris@19 60 typedef enum { IB = 0, OB } block_kind;
Chris@19 61 typedef struct {
Chris@19 62 INT n;
Chris@19 63 INT b[2]; /* b[IB], b[OB] */
Chris@19 64 } ddim;
Chris@19 65
Chris@19 66 /* Loop over k in {IB, OB}. Note: need explicit casts for C++. */
Chris@19 67 #define FORALL_BLOCK_KIND(k) for (k = IB; k <= OB; k = (block_kind) (((int) k) + 1))
Chris@19 68
Chris@19 69 /* unlike tensors in the serial FFTW, the ordering of the dtensor
Chris@19 70 dimensions matters - both the array and the block layout are
Chris@19 71 row-major order. */
Chris@19 72 typedef struct {
Chris@19 73 int rnk;
Chris@19 74 #if defined(STRUCT_HACK_KR)
Chris@19 75 ddim dims[1];
Chris@19 76 #elif defined(STRUCT_HACK_C99)
Chris@19 77 ddim dims[];
Chris@19 78 #else
Chris@19 79 ddim *dims;
Chris@19 80 #endif
Chris@19 81 } dtensor;
Chris@19 82
Chris@19 83
Chris@19 84 /* dtensor.c: */
Chris@19 85 dtensor *XM(mkdtensor)(int rnk);
Chris@19 86 void XM(dtensor_destroy)(dtensor *sz);
Chris@19 87 dtensor *XM(dtensor_copy)(const dtensor *sz);
Chris@19 88 dtensor *XM(dtensor_canonical)(const dtensor *sz, int compress);
Chris@19 89 int XM(dtensor_validp)(const dtensor *sz);
Chris@19 90 void XM(dtensor_md5)(md5 *p, const dtensor *t);
Chris@19 91 void XM(dtensor_print)(const dtensor *t, printer *p);
Chris@19 92
Chris@19 93 /* block.c: */
Chris@19 94
Chris@19 95 /* for a single distributed dimension: */
Chris@19 96 INT XM(num_blocks)(INT n, INT block);
Chris@19 97 int XM(num_blocks_ok)(INT n, INT block, MPI_Comm comm);
Chris@19 98 INT XM(default_block)(INT n, int n_pes);
Chris@19 99 INT XM(block)(INT n, INT block, int which_block);
Chris@19 100
Chris@19 101 /* for multiple distributed dimensions: */
Chris@19 102 INT XM(num_blocks_total)(const dtensor *sz, block_kind k);
Chris@19 103 int XM(idle_process)(const dtensor *sz, block_kind k, int which_pe);
Chris@19 104 void XM(block_coords)(const dtensor *sz, block_kind k, int which_pe,
Chris@19 105 INT *coords);
Chris@19 106 INT XM(total_block)(const dtensor *sz, block_kind k, int which_pe);
Chris@19 107 int XM(is_local_after)(int dim, const dtensor *sz, block_kind k);
Chris@19 108 int XM(is_local)(const dtensor *sz, block_kind k);
Chris@19 109 int XM(is_block1d)(const dtensor *sz, block_kind k);
Chris@19 110
Chris@19 111 /* choose-radix.c */
Chris@19 112 INT XM(choose_radix)(ddim d, int n_pes, unsigned flags, int sign,
Chris@19 113 INT rblock[2], INT mblock[2]);
Chris@19 114
Chris@19 115 /***********************************************************************/
Chris@19 116 /* any_true.c */
Chris@19 117 int XM(any_true)(int condition, MPI_Comm comm);
Chris@19 118 int XM(md5_equal)(md5 m, MPI_Comm comm);
Chris@19 119
Chris@19 120 /* conf.c */
Chris@19 121 void XM(conf_standard)(planner *p);
Chris@19 122
Chris@19 123 /***********************************************************************/
Chris@19 124 /* rearrange.c */
Chris@19 125
Chris@19 126 /* Different ways to rearrange the vector dimension vn during transposition,
Chris@19 127 reflecting different tradeoffs between ease of transposition and
Chris@19 128 contiguity during the subsequent DFTs.
Chris@19 129
Chris@19 130 TODO: can we pare this down to CONTIG and DISCONTIG, at least
Chris@19 131 in MEASURE mode? SQUARE_MIDDLE is also used for 1d destroy-input DFTs. */
Chris@19 132 typedef enum {
Chris@19 133 CONTIG = 0, /* vn x 1: make subsequent DFTs contiguous */
Chris@19 134 DISCONTIG, /* P x (vn/P) for P processes */
Chris@19 135 SQUARE_BEFORE, /* try to get square transpose at beginning */
Chris@19 136 SQUARE_MIDDLE, /* try to get square transpose in the middle */
Chris@19 137 SQUARE_AFTER /* try to get square transpose at end */
Chris@19 138 } rearrangement;
Chris@19 139
Chris@19 140 /* skipping SQUARE_AFTER since it doesn't seem to offer any advantage
Chris@19 141 over SQUARE_BEFORE */
Chris@19 142 #define FORALL_REARRANGE(rearrange) for (rearrange = CONTIG; rearrange <= SQUARE_MIDDLE; rearrange = (rearrangement) (((int) rearrange) + 1))
Chris@19 143
Chris@19 144 int XM(rearrange_applicable)(rearrangement rearrange,
Chris@19 145 ddim dim0, INT vn, int n_pes);
Chris@19 146 INT XM(rearrange_ny)(rearrangement rearrange, ddim dim0, INT vn, int n_pes);
Chris@19 147
Chris@19 148 /***********************************************************************/
Chris@19 149
Chris@19 150 #endif /* __IFFTW_MPI_H__ */
Chris@19 151