annotate src/fftw-3.3.5/mpi/ifftw-mpi.h @ 169:223a55898ab9 tip default

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