Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
#ifndef TEST_MAIN_H
2
#define TEST_MAIN_H
3
 
4
/* max # of dimensions accepted on the command line */
5
#define MAX_CMDLINE_RANK 20
6
 
7
struct size {
8
     int rank;
9
     int is_nd;
10
     int narray[MAX_CMDLINE_RANK];
11
};
12
 
13
/********************
14
 *   macrology:
15
 ********************/
16
#ifndef TRUE
17
#define TRUE 42
18
#endif
19
#ifndef FALSE
20
#define FALSE (!TRUE)
21
#endif
22
 
23
#define CHECK(condition, complaint)      \
24
    if (!(condition)) {                  \
25
        fflush(stdout);                  \
26
        fprintf(stderr, "FATAL ERROR: %s\n", complaint);      \
27
        fftw_die("failed test.\n");         \
28
    }
29
 
30
#define WHEN_VERBOSE(a, x)  if (verbose >= a) x
31
 
32
#ifdef FFTW_ENABLE_FLOAT
33
#define TOLERANCE (1e-2)
34
#else
35
#define TOLERANCE (1e-6)
36
#endif
37
 
38
#define DRAND() mydrand()
39
 
40
#define SPECIFICP(x) (x ? "specific" : "generic")
41
 
42
/*******************
43
 * global variables
44
 *******************/
45
extern int verbose;
46
extern int speed_flag, wisdom_flag, measure_flag;
47
extern int chk_mem_leak;
48
extern int paranoid;
49
extern int howmany_fields;
50
extern int io_okay;
51
 
52
/* Time an FFT routine, invoked by fft.  a is the array being
53
 * transformed, n is its total length.  t should be a variable
54
 * --the time (sec) per fft is assigned to it. */
55
 
56
#define FFTW_TIME_FFT(fft,a,n,t) \
57
{ \
58
     fftw_time ts,te; \
59
     double total_t; \
60
     int tfft_iters = 1, tfft_iter; \
61
     zero_arr((n), (a)); \
62
     do { \
63
          ts = fftw_get_time(); \
64
          for (tfft_iter = 0; tfft_iter < tfft_iters; ++tfft_iter) fft; \
65
          te = fftw_get_time(); \
66
          t = (total_t=fftw_time_to_sec(fftw_time_diff(te,ts))) / tfft_iters; \
67
          tfft_iters *= 2; \
68
     } while (total_t < 2.0); \
69
}
70
 
71
#define MAX_STRIDE 3
72
#define MAX_HOWMANY 3
73
#define MAX_RANK 5
74
#define PLANNER_TEST_SIZE 100
75
 
76
extern int coinflip(void);
77
extern double mydrand(void);
78
extern char *smart_sprint_time(double x);
79
extern void please_wait(void);
80
extern void please_wait_forever(void);
81
extern double mflops(double t, int N);
82
extern void print_dims(struct size sz);
83
 
84
#define SQR(x) ((x) * (x))
85
 
86
extern double compute_error_complex(fftw_complex * A, int astride,
87
                                    fftw_complex * B, int bstride, int n);
88
 
89
extern fftw_direction random_dir(void);
90
 
91
/*** the following symbols should be defined in fftw_test.c/rfftw_test.c ***/
92
extern char fftw_prefix[];
93
extern void test_speed_aux(int n, fftw_direction dir, int flags, int specific);
94
extern void test_speed_nd_aux(struct size sz, fftw_direction dir,
95
                              int flags, int specific);
96
extern void test_correctness(int n);
97
extern void testnd_correctness(struct size sz, fftw_direction dir,
98
                               int alt_api, int specific, int force_buf);
99
extern void test_planner(int rank);
100
 
101
extern void test_init(int *argc, char **argv);
102
extern void test_finish(void);
103
extern void enter_paranoid_mode(void);
104
 
105
extern int get_option(int argc, char **argv,
106
                      char *argval, int argval_maxlen);
107
extern int default_get_option(int argc, char **argv,
108
                              char *argval, int argval_maxlen);
109
 
110
#endif                          /* TEST_MAIN_H */