-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfourier-bench1-dxml.cpp
96 lines (79 loc) · 1.7 KB
/
fourier-bench1-dxml.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "fourier-bench1.h"
#ifdef HAVE_DXML_FFT
namespace dxml {
#include <dxmldef.h>
int stride = 1;
int status;
namespace r2r {
DXML_D_FFT_STRUCTURE fft_struct;
double *in, *out;
struct otest : bench::Test {
otest(int n)
{
bench::init(in, n, out, n);
status = dfft_init(&n, &fft_struct, &stride);
bench::header("DXML", "r2r", "o", "f", n);
}
~otest()
{
dfft_exit(&fft_struct);
bench::free(in, out);
}
void op()
{
status = dfft_apply("real", "real", "f", in, out, &fft_struct, &stride);
};
string opName() const
{
return "dfft_apply";
}
};
}
namespace c2c {
DXML_Z_FFT_STRUCTURE fft_struct;
complex<double> *in, *out;
struct otest : bench::Test {
otest(int n)
{
bench::init(in, n, out, n);
status = zfft_init(&n, &fft_struct, &stride);
bench::header("DXML", "c2c", "o", "f", n);
}
~otest()
{
zfft_exit(&fft_struct);
bench::free(in, out);
}
void op()
{
zfft_apply("complex", "complex", "f", in, out, &fft_struct, &stride);
};
string opName() const
{
return "zfft_apply";
}
};
}
void run(int n, bool verbose)
{
// bench namespace verbose locally scoped
//bench::verbose = true;
{
r2r::otest test(n);
bench::bench(test, n, 0.5, verbose);
}
{
c2c::otest test(n);
bench::bench(test, n, 1.0, verbose);
}
cout << endl;
}
}
#else
namespace dxml {
void run(int n, bool verbose)
{
cout << "DXML port not available." << endl << endl;
}
}
#endif // HAVE_DXML_FFT