Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
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
58eec4f3
authored
Apr 13, 2015
by
Tobias Fuchs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
performance test: improved macros for test setup, fixes for gcc
parent
077e21b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
algorithms_cpp/perf/for_each_perf-inl.h
+8
-8
base_cpp/perf/include/embb/base/perf/perf.h
+6
-8
No files found.
algorithms_cpp/perf/for_each_perf-inl.h
View file @
58eec4f3
...
@@ -41,7 +41,7 @@ namespace perf {
...
@@ -41,7 +41,7 @@ namespace perf {
template
<
typename
T
>
template
<
typename
T
>
SerialForEach
<
T
>::
SerialForEach
(
const
embb
::
base
::
perf
::
CallArgs
&
args
)
SerialForEach
<
T
>::
SerialForEach
(
const
embb
::
base
::
perf
::
CallArgs
&
args
)
:
cargs
(
args
),
op
(
args
),
vector_size
(
args
.
VectorSize
())
{
:
cargs
(
args
),
op
(
args
),
vector_size
(
args
.
VectorSize
())
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
v
=
static_cast
<
T
*>
(
embb
::
base
::
Allocation
::
AllocateCacheAligned
(
v
=
static_cast
<
T
*>
(
embb
::
base
::
Allocation
::
AllocateCacheAligned
(
vector_size
*
sizeof
(
T
)));
vector_size
*
sizeof
(
T
)));
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
...
@@ -54,19 +54,19 @@ SerialForEach<T>::SerialForEach(const embb::base::perf::CallArgs & args)
...
@@ -54,19 +54,19 @@ SerialForEach<T>::SerialForEach(const embb::base::perf::CallArgs & args)
template
<
typename
T
>
template
<
typename
T
>
SerialForEach
<
T
>::~
SerialForEach
()
{
SerialForEach
<
T
>::~
SerialForEach
()
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
embb
::
base
::
Allocation
::
FreeAligned
(
v
);
embb
::
base
::
Allocation
::
FreeAligned
(
v
);
}
}
}
}
template
<
typename
T
>
template
<
typename
T
>
void
SerialForEach
<
T
>::
Run
()
{
void
SerialForEach
<
T
>::
Run
()
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
CPU_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
CPU_STRESS
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
T
v
=
static_cast
<
T
>
(
i
);
T
v
=
static_cast
<
T
>
(
i
);
op
(
v
);
op
(
v
);
}
}
}
else
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
}
else
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
op
(
v
[
i
]);
op
(
v
[
i
]);
}
}
...
@@ -76,7 +76,7 @@ void SerialForEach<T>::Run() {
...
@@ -76,7 +76,7 @@ void SerialForEach<T>::Run() {
template
<
typename
T
>
template
<
typename
T
>
ParallelForEach
<
T
>::
ParallelForEach
(
const
embb
::
base
::
perf
::
CallArgs
&
args
)
ParallelForEach
<
T
>::
ParallelForEach
(
const
embb
::
base
::
perf
::
CallArgs
&
args
)
:
cargs
(
args
),
vector_size
(
args
.
VectorSize
())
{
:
cargs
(
args
),
vector_size
(
args
.
VectorSize
())
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
v
=
static_cast
<
T
*>
(
embb
::
base
::
Allocation
::
AllocateCacheAligned
(
v
=
static_cast
<
T
*>
(
embb
::
base
::
Allocation
::
AllocateCacheAligned
(
vector_size
*
sizeof
(
T
)));
vector_size
*
sizeof
(
T
)));
}
else
{
}
else
{
...
@@ -93,7 +93,7 @@ ParallelForEach<T>::~ParallelForEach() {
...
@@ -93,7 +93,7 @@ ParallelForEach<T>::~ParallelForEach() {
template
<
typename
T
>
template
<
typename
T
>
void
ParallelForEach
<
T
>::
Pre
()
{
void
ParallelForEach
<
T
>::
Pre
()
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
// Initialize input vector with incrementing values:
// Initialize input vector with incrementing values:
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
vector_size
;
i
++
)
{
v
[
i
]
=
static_cast
<
T
>
(
i
);
v
[
i
]
=
static_cast
<
T
>
(
i
);
...
@@ -103,7 +103,7 @@ void ParallelForEach<T>::Pre() {
...
@@ -103,7 +103,7 @@ void ParallelForEach<T>::Pre() {
template
<
typename
T
>
template
<
typename
T
>
void
ParallelForEach
<
T
>::
Run
(
unsigned
int
numThreads
)
{
void
ParallelForEach
<
T
>::
Run
(
unsigned
int
numThreads
)
{
if
(
cargs
.
StressMode
()
==
CallArgs
::
CPU_STRESS
)
{
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
CPU_STRESS
)
{
// Computing input values, no memory access
// Computing input values, no memory access
ForEachFunctor
<
T
>
op
(
cargs
);
ForEachFunctor
<
T
>
op
(
cargs
);
embb
::
algorithms
::
ForEach
(
embb
::
algorithms
::
ForEach
(
...
@@ -114,7 +114,7 @@ void ParallelForEach<T>::Run(unsigned int numThreads) {
...
@@ -114,7 +114,7 @@ void ParallelForEach<T>::Run(unsigned int numThreads) {
op
,
op
,
embb
::
tasks
::
ExecutionPolicy
(),
embb
::
tasks
::
ExecutionPolicy
(),
vector_size
/
numThreads
);
vector_size
/
numThreads
);
}
else
if
(
cargs
.
StressMode
()
==
CallArgs
::
RAM_STRESS
)
{
}
else
if
(
cargs
.
StressMode
()
==
embb
::
base
::
perf
::
CallArgs
::
RAM_STRESS
)
{
// Reading input values from memory
// Reading input values from memory
ForEachFunctor
<
T
>
op
(
cargs
);
ForEachFunctor
<
T
>
op
(
cargs
);
embb
::
algorithms
::
ForEach
(
embb
::
algorithms
::
ForEach
(
...
...
base_cpp/perf/include/embb/base/perf/perf.h
View file @
58eec4f3
...
@@ -34,11 +34,6 @@
...
@@ -34,11 +34,6 @@
#include <iomanip>
#include <iomanip>
#define PT_PERF_MAIN(component) \
#define PT_PERF_MAIN(component) \
template <class Test> \
void PartestRunPerformanceTest(Test & test) { \
test.Run(); \
test.PrintReport(std::cout); \
} \
void PartestRunPerformanceTests( \
void PartestRunPerformanceTests( \
embb::base::perf::CallArgs & perf_test_params); \
embb::base::perf::CallArgs & perf_test_params); \
int main(int argc, char** argv) { \
int main(int argc, char** argv) { \
...
@@ -59,8 +54,12 @@ void PartestRunPerformanceTests( \
...
@@ -59,8 +54,12 @@ void PartestRunPerformanceTests( \
#define PT_PERF_RUN(PT_PERF_TEST) \
#define PT_PERF_RUN(PT_PERF_TEST) \
( \
( \
(std::cout << "Running " << #PT_PERF_TEST << " ..." << std::endl), \
(std::cout << "Running " << #PT_PERF_TEST << " ..." << std::endl), \
PartestRunPerformanceTest<PT_PERF_TEST>(PT_PERF_TEST(perf_test_params)), \
({ \
PT_PERF_TEST perf_test(perf_test_params); \
perf_test.Run(); \
perf_test.PrintReport(std::cout); \
}), \
(std::cout << "Running " << #PT_PERF_TEST << " ..." << " done" << std::endl) \
(std::cout << "Running " << #PT_PERF_TEST << " ..." << " done" << std::endl) \
)
)
#endif // EMBB_BASE_CPP_PERF_PERF_H_
#endif // EMBB_BASE_CPP_PERF_PERF_H_
\ No newline at end of file
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