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