Subversion Repositories shark

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1063 tullio 1
 
2
/*
3
 * This program is free software; you can redistribute it and/or modify
4
 * it under the terms of the GNU General Public License as published by
5
 * the Free Software Foundation; either version 2 of the License, or
6
 * (at your option) any later version.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program; if not, write to the Free Software
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 *
17
 */
18
 
2 pj 19
#ifndef TEST_MAIN_H
20
#define TEST_MAIN_H
21
 
22
/* max # of dimensions accepted on the command line */
23
#define MAX_CMDLINE_RANK 20
24
 
25
struct size {
26
     int rank;
27
     int is_nd;
28
     int narray[MAX_CMDLINE_RANK];
29
};
30
 
31
/********************
32
 *   macrology:
33
 ********************/
34
#ifndef TRUE
35
#define TRUE 42
36
#endif
37
#ifndef FALSE
38
#define FALSE (!TRUE)
39
#endif
40
 
41
#define CHECK(condition, complaint)      \
42
    if (!(condition)) {                  \
43
        fflush(stdout);                  \
44
        fprintf(stderr, "FATAL ERROR: %s\n", complaint);      \
45
        fftw_die("failed test.\n");         \
46
    }
47
 
48
#define WHEN_VERBOSE(a, x)  if (verbose >= a) x
49
 
50
#ifdef FFTW_ENABLE_FLOAT
51
#define TOLERANCE (1e-2)
52
#else
53
#define TOLERANCE (1e-6)
54
#endif
55
 
56
#define DRAND() mydrand()
57
 
58
#define SPECIFICP(x) (x ? "specific" : "generic")
59
 
60
/*******************
61
 * global variables
62
 *******************/
63
extern int verbose;
64
extern int speed_flag, wisdom_flag, measure_flag;
65
extern int chk_mem_leak;
66
extern int paranoid;
67
extern int howmany_fields;
68
extern int io_okay;
69
 
70
/* Time an FFT routine, invoked by fft.  a is the array being
71
 * transformed, n is its total length.  t should be a variable
72
 * --the time (sec) per fft is assigned to it. */
73
 
74
#define FFTW_TIME_FFT(fft,a,n,t) \
75
{ \
76
     fftw_time ts,te; \
77
     double total_t; \
78
     int tfft_iters = 1, tfft_iter; \
79
     zero_arr((n), (a)); \
80
     do { \
81
          ts = fftw_get_time(); \
82
          for (tfft_iter = 0; tfft_iter < tfft_iters; ++tfft_iter) fft; \
83
          te = fftw_get_time(); \
84
          t = (total_t=fftw_time_to_sec(fftw_time_diff(te,ts))) / tfft_iters; \
85
          tfft_iters *= 2; \
86
     } while (total_t < 2.0); \
87
}
88
 
89
#define MAX_STRIDE 3
90
#define MAX_HOWMANY 3
91
#define MAX_RANK 5
92
#define PLANNER_TEST_SIZE 100
93
 
94
extern int coinflip(void);
95
extern double mydrand(void);
96
extern char *smart_sprint_time(double x);
97
extern void please_wait(void);
98
extern void please_wait_forever(void);
99
extern double mflops(double t, int N);
100
extern void print_dims(struct size sz);
101
 
102
#define SQR(x) ((x) * (x))
103
 
104
extern double compute_error_complex(fftw_complex * A, int astride,
105
                                    fftw_complex * B, int bstride, int n);
106
 
107
extern fftw_direction random_dir(void);
108
 
109
/*** the following symbols should be defined in fftw_test.c/rfftw_test.c ***/
110
extern char fftw_prefix[];
111
extern void test_speed_aux(int n, fftw_direction dir, int flags, int specific);
112
extern void test_speed_nd_aux(struct size sz, fftw_direction dir,
113
                              int flags, int specific);
114
extern void test_correctness(int n);
115
extern void testnd_correctness(struct size sz, fftw_direction dir,
116
                               int alt_api, int specific, int force_buf);
117
extern void test_planner(int rank);
118
 
119
extern void test_init(int *argc, char **argv);
120
extern void test_finish(void);
121
extern void enter_paranoid_mode(void);
122
 
123
extern int get_option(int argc, char **argv,
124
                      char *argval, int argval_maxlen);
125
extern int default_get_option(int argc, char **argv,
126
                              char *argval, int argval_maxlen);
127
 
128
#endif                          /* TEST_MAIN_H */