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
d054e1ab
authored
Jan 04, 2020
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fib benchmark.
parent
79ac0243
Pipeline
#1373
failed with stages
in 39 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
4 deletions
+111
-4
CMakeLists.txt
+1
-0
app/benchmark_fib/CMakeLists.txt
+5
-0
app/benchmark_fib/main.cpp
+84
-0
extern/benchmark_base/CMakeLists.txt
+2
-1
extern/benchmark_base/include/benchmark_base/fib.h
+18
-0
extern/benchmark_base/include/benchmark_base/matrix.h
+1
-3
No files found.
CMakeLists.txt
View file @
d054e1ab
...
...
@@ -42,6 +42,7 @@ add_subdirectory(app/benchmark_unbalanced)
add_subdirectory
(
app/benchmark_matrix
)
add_subdirectory
(
app/benchmark_prefix
)
add_subdirectory
(
app/benchmark_pipeline
)
add_subdirectory
(
app/benchmark_fib
)
# Add optional tests
option
(
PACKAGE_TESTS
"Build the tests"
ON
)
...
...
app/benchmark_fib/CMakeLists.txt
0 → 100644
View file @
d054e1ab
add_executable
(
benchmark_fib_pls_v2 main.cpp
)
target_link_libraries
(
benchmark_fib_pls_v2 pls benchmark_runner benchmark_base
)
if
(
EASY_PROFILER
)
target_link_libraries
(
benchmark_fib_pls_v2 easy_profiler
)
endif
()
app/benchmark_fib/main.cpp
0 → 100644
View file @
d054e1ab
#include "pls/internal/scheduling/scheduler.h"
#include "pls/internal/scheduling/parallel_result.h"
#include "pls/internal/scheduling/scheduler_memory.h"
#include "pls/internal/helpers/profiler.h"
using
namespace
pls
::
internal
::
scheduling
;
#include <iostream>
#include <complex>
#include <vector>
#include "benchmark_runner.h"
#include "benchmark_base/fib.h"
using
namespace
comparison_benchmarks
::
base
;
parallel_result
<
int
>
pls_fib
(
int
n
)
{
if
(
n
<=
1
)
{
return
parallel_result
<
int
>
{
1
};
}
return
scheduler
::
par
([
=
]()
{
return
pls_fib
(
n
-
1
);
},
[
=
]()
{
return
pls_fib
(
n
-
2
);
}).
then
([
=
](
int
a
,
int
b
)
{
return
parallel_result
<
int
>
{
a
+
b
};
});
}
constexpr
int
MAX_NUM_THREADS
=
8
;
constexpr
int
MAX_NUM_TASKS
=
64
;
constexpr
int
MAX_NUM_CONTS
=
64
;
constexpr
int
MAX_CONT_SIZE
=
256
;
int
main
(
int
argc
,
char
**
argv
)
{
int
num_threads
;
string
directory
;
benchmark_runner
::
read_args
(
argc
,
argv
,
num_threads
,
directory
);
string
test_name
=
to_string
(
num_threads
)
+
".csv"
;
string
full_directory
=
directory
+
"/PLS_v2/"
;
benchmark_runner
runner
{
full_directory
,
test_name
};
static_scheduler_memory
<
MAX_NUM_THREADS
,
MAX_NUM_TASKS
,
MAX_NUM_CONTS
,
MAX_CONT_SIZE
>
static_scheduler_memory
;
scheduler
scheduler
{
static_scheduler_memory
,
(
unsigned
int
)
num_threads
};
volatile
int
res
;
for
(
int
i
=
0
;
i
<
fib
::
NUM_WARMUP_ITERATIONS
;
i
++
)
{
scheduler
.
perform_work
([
&
]()
{
return
scheduler
::
par
([
&
]()
{
return
pls_fib
(
fib
::
INPUT_N
);
},
[]()
{
return
parallel_result
<
int
>
{
0
};
}).
then
([
&
](
int
result
,
int
)
{
res
=
result
;
return
parallel_result
<
int
>
{
0
};
});
});
}
for
(
int
i
=
0
;
i
<
fib
::
NUM_ITERATIONS
;
i
++
)
{
scheduler
.
perform_work
([
&
]()
{
runner
.
start_iteration
();
return
scheduler
::
par
([
&
]()
{
return
pls_fib
(
fib
::
INPUT_N
);
},
[]()
{
return
parallel_result
<
int
>
{
0
};
}).
then
([
&
](
int
result
,
int
)
{
res
=
result
;
runner
.
end_iteration
();
return
parallel_result
<
int
>
{
0
};
});
});
}
runner
.
commit_results
(
true
);
return
0
;
}
extern/benchmark_base/CMakeLists.txt
View file @
d054e1ab
...
...
@@ -7,7 +7,8 @@ add_library(benchmark_base STATIC
include/benchmark_base/heat.h
include/benchmark_base/matrix.h
include/benchmark_base/unbalanced.h src/unbalanced.cpp
include/benchmark_base/range.h
)
include/benchmark_base/range.h
include/benchmark_base/fib.h
)
target_include_directories
(
benchmark_base
PUBLIC
...
...
extern/benchmark_base/include/benchmark_base/fib.h
0 → 100644
View file @
d054e1ab
#ifndef COMPARISON_BENCHMARKS_BASE_FIB_H_
#define COMPARISON_BENCHMARKS_BASE_FIB_H_
namespace
comparison_benchmarks
{
namespace
base
{
namespace
fib
{
const
int
INPUT_N
=
18
;
const
int
NUM_ITERATIONS
=
1000
;
const
int
NUM_WARMUP_ITERATIONS
=
100
;
}
}
}
#endif //COMPARISON_BENCHMARKS_BASE_FIB_H_
extern/benchmark_base/include/benchmark_base/matrix.h
View file @
d054e1ab
...
...
@@ -40,9 +40,7 @@ class matrix {
}
for
(
int
k
=
0
;
k
<
SIZE
;
++
k
)
{
for
(
int
j
=
0
;
j
<
SIZE
;
++
j
)
{
T
a_data
=
a
.
data
[
i
][
k
];
T
b_data
=
b
.
data
[
k
][
j
];
data
[
i
][
j
]
+=
a_data
*
b_data
;
data
[
i
][
j
]
+=
a
.
data
[
i
][
k
]
*
b
.
data
[
k
][
j
];
}
}
}
...
...
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