annotate src/fftw-3.3.8/mpi/rdft2-problem.c @ 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 #include "mpi-rdft2.h"
cannam@167 22
cannam@167 23 static void destroy(problem *ego_)
cannam@167 24 {
cannam@167 25 problem_mpi_rdft2 *ego = (problem_mpi_rdft2 *) ego_;
cannam@167 26 XM(dtensor_destroy)(ego->sz);
cannam@167 27 MPI_Comm_free(&ego->comm);
cannam@167 28 X(ifree)(ego_);
cannam@167 29 }
cannam@167 30
cannam@167 31 static void hash(const problem *p_, md5 *m)
cannam@167 32 {
cannam@167 33 const problem_mpi_rdft2 *p = (const problem_mpi_rdft2 *) p_;
cannam@167 34 int i;
cannam@167 35 X(md5puts)(m, "mpi-rdft2");
cannam@167 36 X(md5int)(m, p->I == p->O);
cannam@167 37 /* don't include alignment -- may differ between processes
cannam@167 38 X(md5int)(m, X(ialignment_of)(p->I));
cannam@167 39 X(md5int)(m, X(ialignment_of)(p->O));
cannam@167 40 ... note that applicability of MPI plans does not depend
cannam@167 41 on alignment (although optimality may, in principle). */
cannam@167 42 XM(dtensor_md5)(m, p->sz);
cannam@167 43 X(md5INT)(m, p->vn);
cannam@167 44 X(md5int)(m, p->kind);
cannam@167 45 X(md5int)(m, p->flags);
cannam@167 46 MPI_Comm_size(p->comm, &i); X(md5int)(m, i);
cannam@167 47 A(XM(md5_equal)(*m, p->comm));
cannam@167 48 }
cannam@167 49
cannam@167 50 static void print(const problem *ego_, printer *p)
cannam@167 51 {
cannam@167 52 const problem_mpi_rdft2 *ego = (const problem_mpi_rdft2 *) ego_;
cannam@167 53 int i;
cannam@167 54 p->print(p, "(mpi-rdft2 %d %d %d ",
cannam@167 55 ego->I == ego->O,
cannam@167 56 X(ialignment_of)(ego->I),
cannam@167 57 X(ialignment_of)(ego->O));
cannam@167 58 XM(dtensor_print)(ego->sz, p);
cannam@167 59 p->print(p, " %D %d %d", ego->vn, (int) ego->kind, ego->flags);
cannam@167 60 MPI_Comm_size(ego->comm, &i); p->print(p, " %d)", i);
cannam@167 61 }
cannam@167 62
cannam@167 63 static void zero(const problem *ego_)
cannam@167 64 {
cannam@167 65 const problem_mpi_rdft2 *ego = (const problem_mpi_rdft2 *) ego_;
cannam@167 66 R *I = ego->I;
cannam@167 67 dtensor *sz;
cannam@167 68 INT i, N;
cannam@167 69 int my_pe;
cannam@167 70
cannam@167 71 sz = XM(dtensor_copy)(ego->sz);
cannam@167 72 sz->dims[sz->rnk - 1].n = sz->dims[sz->rnk - 1].n / 2 + 1;
cannam@167 73 MPI_Comm_rank(ego->comm, &my_pe);
cannam@167 74 N = 2 * ego->vn * XM(total_block)(sz, IB, my_pe);
cannam@167 75 XM(dtensor_destroy)(sz);
cannam@167 76 for (i = 0; i < N; ++i) I[i] = K(0.0);
cannam@167 77 }
cannam@167 78
cannam@167 79 static const problem_adt padt =
cannam@167 80 {
cannam@167 81 PROBLEM_MPI_RDFT2,
cannam@167 82 hash,
cannam@167 83 zero,
cannam@167 84 print,
cannam@167 85 destroy
cannam@167 86 };
cannam@167 87
cannam@167 88 problem *XM(mkproblem_rdft2)(const dtensor *sz, INT vn,
cannam@167 89 R *I, R *O,
cannam@167 90 MPI_Comm comm,
cannam@167 91 rdft_kind kind,
cannam@167 92 unsigned flags)
cannam@167 93 {
cannam@167 94 problem_mpi_rdft2 *ego =
cannam@167 95 (problem_mpi_rdft2 *)X(mkproblem)(sizeof(problem_mpi_rdft2), &padt);
cannam@167 96 int n_pes;
cannam@167 97
cannam@167 98 A(XM(dtensor_validp)(sz) && FINITE_RNK(sz->rnk) && sz->rnk > 1);
cannam@167 99 MPI_Comm_size(comm, &n_pes);
cannam@167 100 A(vn >= 0);
cannam@167 101 A(kind == R2HC || kind == HC2R);
cannam@167 102
cannam@167 103 /* enforce pointer equality if untainted pointers are equal */
cannam@167 104 if (UNTAINT(I) == UNTAINT(O))
cannam@167 105 I = O = JOIN_TAINT(I, O);
cannam@167 106
cannam@167 107 ego->sz = XM(dtensor_canonical)(sz, 0);
cannam@167 108 #ifdef FFTW_DEBUG
cannam@167 109 ego->sz->dims[sz->rnk - 1].n = sz->dims[sz->rnk - 1].n / 2 + 1;
cannam@167 110 A(n_pes >= XM(num_blocks_total)(ego->sz, IB)
cannam@167 111 && n_pes >= XM(num_blocks_total)(ego->sz, OB));
cannam@167 112 ego->sz->dims[sz->rnk - 1].n = sz->dims[sz->rnk - 1].n;
cannam@167 113 #endif
cannam@167 114
cannam@167 115 ego->vn = vn;
cannam@167 116 ego->I = I;
cannam@167 117 ego->O = O;
cannam@167 118 ego->kind = kind;
cannam@167 119
cannam@167 120 /* We only support TRANSPOSED_OUT for r2c and TRANSPOSED_IN for
cannam@167 121 c2r transforms. */
cannam@167 122
cannam@167 123 ego->flags = flags;
cannam@167 124
cannam@167 125 MPI_Comm_dup(comm, &ego->comm);
cannam@167 126
cannam@167 127 return &(ego->super);
cannam@167 128 }
cannam@167 129
cannam@167 130 problem *XM(mkproblem_rdft2_d)(dtensor *sz, INT vn,
cannam@167 131 R *I, R *O,
cannam@167 132 MPI_Comm comm,
cannam@167 133 rdft_kind kind,
cannam@167 134 unsigned flags)
cannam@167 135 {
cannam@167 136 problem *p = XM(mkproblem_rdft2)(sz, vn, I, O, comm, kind, flags);
cannam@167 137 XM(dtensor_destroy)(sz);
cannam@167 138 return p;
cannam@167 139 }