~ubuntu-branches/ubuntu/raring/fftw3/raring-proposed

« back to all changes in this revision

Viewing changes to threads/vrank-geq1-rdft2.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2006-05-31 13:44:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060531134405-ol9hrbg6bh81sg0c
Tags: 3.1.1-1
* New upstream release (closes: #350327, #338487, #338501)
* Add --enable-portable-binary to use -mtune instead of -march
* Use --with-gcc-arch=G5 / pentium4 on powerpc / i386
* Updated Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2003 Matteo Frigo
3
 
 * Copyright (c) 2003 Massachusetts Institute of Technology
 
2
 * Copyright (c) 2003, 2006 Matteo Frigo
 
3
 * Copyright (c) 2003, 2006 Massachusetts Institute of Technology
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
18
18
 *
19
19
 */
20
20
 
21
 
/* $Id: vrank-geq1-rdft2.c,v 1.18 2003/04/03 12:50:43 athena Exp $ */
 
21
/* $Id: vrank-geq1-rdft2.c,v 1.24 2006-01-27 02:10:50 athena Exp $ */
22
22
 
23
23
 
24
24
#include "threads.h"
34
34
     plan_rdft2 super;
35
35
 
36
36
     plan **cldrn;
37
 
     int its, ots;
 
37
     INT its, ots;
38
38
     int nthr;
39
39
     const S *solver;
40
40
} P;
41
41
 
42
42
typedef struct {
43
 
     int its, ots;
 
43
     INT its, ots;
44
44
     R *r, *rio, *iio;
45
45
     plan **cldrn;
46
46
} PD;
48
48
static void *spawn_apply(spawn_data *d)
49
49
WITH_ALIGNED_STACK({
50
50
     PD *ego = (PD *) d->data;
51
 
     int its = ego->its;
52
 
     int ots = ego->ots;
 
51
     INT its = ego->its;
 
52
     INT ots = ego->ots;
53
53
     int thr_num = d->thr_num;
54
54
     plan_rdft2 *cld = (plan_rdft2 *) ego->cldrn[d->thr_num];
55
55
 
72
72
     X(spawn_loop)(ego->nthr, ego->nthr, spawn_apply, (void*) &d);
73
73
}
74
74
 
75
 
static void awake(plan *ego_, int flg)
 
75
static void awake(plan *ego_, enum wakefulness wakefulness)
76
76
{
77
77
     P *ego = (P *) ego_;
78
78
     int i;
79
79
     for (i = 0; i < ego->nthr; ++i)
80
 
          AWAKE(ego->cldrn[i], flg);
 
80
          X(plan_awake)(ego->cldrn[i], wakefulness);
81
81
}
82
82
 
83
83
static void destroy(plan *ego_)
111
111
static int applicable0(const solver *ego_, const problem *p_,
112
112
                       const planner *plnr, int *dp)
113
113
{
114
 
     if (RDFT2P(p_) && plnr->nthr > 1) {
115
 
          const S *ego = (const S *) ego_;
116
 
          const problem_rdft2 *p = (const problem_rdft2 *) p_;
117
 
          if (FINITE_RNK(p->vecsz->rnk)
118
 
              && p->vecsz->rnk > 0
119
 
              && pickdim(ego, p->vecsz, 
120
 
                         p->r != p->rio && p->r != p->iio, dp)) {
121
 
               if (p->r != p->rio && p->r != p->iio)
122
 
                    return 1;  /* can always operate out-of-place */
123
 
 
124
 
               return(X(rdft2_inplace_strides)(p, *dp));
125
 
          }
 
114
     const S *ego = (const S *) ego_;
 
115
     const problem_rdft2 *p = (const problem_rdft2 *) p_;
 
116
 
 
117
     if (FINITE_RNK(p->vecsz->rnk)
 
118
         && p->vecsz->rnk > 0
 
119
         && plnr->nthr > 1
 
120
         && pickdim(ego, p->vecsz, 
 
121
                    p->r != p->rio && p->r != p->iio, dp)) {
 
122
          if (p->r != p->rio && p->r != p->iio)
 
123
               return 1;  /* can always operate out-of-place */
 
124
 
 
125
          return(X(rdft2_inplace_strides)(p, *dp));
126
126
     }
127
127
 
128
128
     return 0;
151
151
     int vdim;
152
152
     iodim *d;
153
153
     plan **cldrn = (plan **) 0;
154
 
     int i, block_size, nthr;
155
 
     int its, ots;
 
154
     int i, nthr;
 
155
     INT its, ots, block_size;
156
156
     tensor *vecsz;
157
157
 
158
158
     static const plan_adt padt = {
166
166
     d = p->vecsz->dims + vdim;
167
167
 
168
168
     block_size = (d->n + plnr->nthr - 1) / plnr->nthr;
169
 
     nthr = (d->n + block_size - 1) / block_size;
 
169
     nthr = (int)((d->n + block_size - 1) / block_size);
170
170
     plnr->nthr = (plnr->nthr + nthr - 1) / nthr;
171
171
     X(rdft2_strides)(p->kind, d, &its, &ots);
172
172
     its *= block_size; ots *= block_size;
173
173
 
174
 
     cldrn = MALLOC(sizeof(plan *) * nthr, PLANS);
 
174
     cldrn = (plan **)MALLOC(sizeof(plan *) * nthr, PLANS);
175
175
     for (i = 0; i < nthr; ++i) cldrn[i] = (plan *) 0;
176
176
     
177
177
     vecsz = X(tensor_copy)(p->vecsz);
215
215
 
216
216
static solver *mksolver(int vecloop_dim, const int *buddies, int nbuddies)
217
217
{
218
 
     static const solver_adt sadt = { mkplan };
 
218
     static const solver_adt sadt = { PROBLEM_RDFT2, mkplan };
219
219
     S *slv = MKSOLVER(S, &sadt);
220
220
     slv->vecloop_dim = vecloop_dim;
221
221
     slv->buddies = buddies;
230
230
     /* FIXME: Should we try other vecloop_dim values? */
231
231
     static const int buddies[] = { 1, -1 };
232
232
 
233
 
     const int nbuddies = sizeof(buddies) / sizeof(buddies[0]);
 
233
     const int nbuddies = (int)(sizeof(buddies) / sizeof(buddies[0]));
234
234
 
235
235
     for (i = 0; i < nbuddies; ++i)
236
236
          REGISTER_SOLVER(p, mksolver(buddies[i], buddies, nbuddies));