annotate src/fftw-3.3.3/mpi/ifftw-mpi.h @ 23:619f715526df sv_v2.1

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