Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
predictable_parallel_patterns
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
15c71232
authored
Feb 23, 2020
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust FFT benchmark to use same data in each iteration.
parent
e0604d1f
Pipeline
#1412
failed with stages
in 37 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
19 deletions
+18
-19
app/benchmark_fft/main.cpp
+6
-3
extern/benchmark_base/include/benchmark_base/fft.h
+1
-1
extern/benchmark_base/src/fft.cpp
+3
-12
extern/benchmark_runner/benchmark_runner.h
+8
-3
No files found.
app/benchmark_fft/main.cpp
View file @
15c71232
...
...
@@ -43,8 +43,9 @@ int main(int argc, char **argv) {
string
full_directory
=
directory
+
"/PLS_v3/"
;
benchmark_runner
runner
{
full_directory
,
test_name
};
fft
::
complex_vector
data
=
fft
::
generate_input
();
fft
::
complex_vector
swap_array
(
data
.
size
());
fft
::
complex_vector
data
(
fft
::
SIZE
);
fft
::
complex_vector
swap_array
(
fft
::
SIZE
);
fft
::
fill_input
(
data
);
static_scheduler_memory
<
MAX_NUM_THREADS
,
MAX_NUM_TASKS
,
...
...
@@ -55,7 +56,9 @@ int main(int argc, char **argv) {
scheduler
.
perform_work
([
&
]()
{
pls_conquer
(
data
.
begin
(),
swap_array
.
begin
(),
fft
::
SIZE
);;
});
},
fft
::
NUM_WARMUP_ITERATIONS
);
},
fft
::
NUM_WARMUP_ITERATIONS
,
[
&
]()
{
fft
::
fill_input
(
data
);
// Reset data before each run
});
runner
.
commit_results
(
true
);
return
0
;
...
...
extern/benchmark_base/include/benchmark_base/fft.h
View file @
15c71232
...
...
@@ -16,7 +16,7 @@ const int NUM_WARMUP_ITERATIONS = 100;
const
int
RECURSIVE_CUTOFF
=
32
;
typedef
std
::
vector
<
std
::
complex
<
double
>>
complex_vector
;
complex_vector
generate_input
(
);
void
fill_input
(
fft
::
complex_vector
&
data
);
void
divide
(
complex_vector
::
iterator
data
,
complex_vector
::
iterator
swap_array
,
int
n
);
void
conquer
(
complex_vector
::
iterator
data
,
complex_vector
::
iterator
swap_array
,
int
n
);
...
...
extern/benchmark_base/src/fft.cpp
View file @
15c71232
...
...
@@ -4,19 +4,10 @@ namespace comparison_benchmarks {
namespace
base
{
namespace
fft
{
complex_vector
generate_input
()
{
std
::
vector
<
double
>
known_frequencies
{
2
,
11
,
52
,
88
,
256
};
fft
::
complex_vector
data
(
SIZE
);
// Set our input data to match a time series of the known_frequencies.
// When applying fft to this time-series we should find these frequencies.
for
(
int
i
=
0
;
i
<
SIZE
;
i
++
)
{
data
[
i
]
=
std
::
complex
<
double
>
(
0.0
,
0.0
);
for
(
auto
frequencie
:
known_frequencies
)
{
data
[
i
]
+=
sin
(
2
*
M_PI
*
frequencie
*
i
/
SIZE
);
}
void
fill_input
(
fft
::
complex_vector
&
data
)
{
for
(
size_t
i
=
0
;
i
<
data
.
size
();
i
++
)
{
data
[
i
]
=
std
::
complex
<
double
>
(
sin
(
i
),
0.0
);
}
return
data
;
}
void
divide
(
complex_vector
::
iterator
data
,
complex_vector
::
iterator
tmp_odd_elements
,
int
n
)
{
...
...
extern/benchmark_runner/benchmark_runner.h
View file @
15c71232
...
...
@@ -65,14 +65,19 @@ class benchmark_runner {
times_
.
emplace_back
(
time
);
}
void
run_iterations
(
int
count
,
function
<
void
(
void
)
>
f
,
int
warmup_count
)
{
void
run_iterations
(
int
count
,
const
function
<
void
(
void
)
>
measure
,
int
warmup_count
,
const
function
<
void
(
void
)
>
prepare
=
[]()
{})
{
for
(
int
i
=
0
;
i
<
warmup_count
;
i
++
)
{
f
();
prepare
();
measure
();
}
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
prepare
();
start_iteration
();
f
();
measure
();
end_iteration
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment