Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EXADUNE
dune-common
Commits
5e209765
Commit
5e209765
authored
11 years ago
by
Steffen Müthing
Browse files
Options
Downloads
Patches
Plain Diff
[Tests] Add simple test running a TBB program if TBB was found
parent
d8fb9a6b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/common/test/.gitignore
+1
-0
1 addition, 0 deletions
dune/common/test/.gitignore
dune/common/test/Makefile.am
+13
-0
13 additions, 0 deletions
dune/common/test/Makefile.am
dune/common/test/tbbruntest.cc
+40
-0
40 additions, 0 deletions
dune/common/test/tbbruntest.cc
with
54 additions
and
0 deletions
dune/common/test/.gitignore
+
1
−
0
View file @
5e209765
...
...
@@ -72,3 +72,4 @@ testdebugallocator_fail5
eigenvaluestest
*.log
*.trs
tbbruntest
This diff is collapsed.
Click to expand it.
dune/common/test/Makefile.am
+
13
−
0
View file @
5e209765
...
...
@@ -57,6 +57,12 @@ TESTPROGS = \
tupleutilitytest
\
utilitytest
# only run this test if TBB is availabe
if
TBB
TESTPROGS
+=
tbbruntest
endif
# which tests to run
COMPILE_XFAIL
=
$(
DUNE_COMMON_BIN
)
/xfail-compile-tests
...
...
@@ -209,6 +215,13 @@ singletontest_SOURCES = singletontest.cc
utilitytest_SOURCES
=
utilitytest.cc
if
TBB
tbbruntest_SOURCES
=
tbbruntest.cc
tbbruntest_CPPFLAGS
=
$(
AM_CPPFLAGS
)
$(
TBB_CPPFLAGS
)
tbbruntest_LDADD
=
$(
TBB_LIBS
)
$(
LDADD
)
tbbruntest_LDFLAGS
=
$(
AM_LDFLAGS
)
$(
TBB_LDFLAGS
)
endif
testdebugallocator_SOURCES
=
testdebugallocator.cc
testdebugallocator_CPPFLAGS
=
$(
AM_CPPFLAGS
)
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/tbbruntest.cc
0 → 100644
+
40
−
0
View file @
5e209765
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
<tbb/tbb.h>
#include
<numeric>
#include
<iostream>
#if __cplusplus < 201103L
// provide a fallback for compilers without lambdas
struct
add
{
add
(
int
*
x
)
:
_x
(
x
)
{}
int
*
_x
;
void
operator
()(
int
i
)
const
{
_x
[
i
]
=
i
;
}
};
#endif
int
main
()
{
int
x
[
10
]
=
{
0
};
#if __cplusplus >= 201103L
tbb
::
parallel_for
(
0
,
10
,[
&
](
int
i
){
x
[
i
]
=
i
;
});
#else
tbb
::
parallel_for
(
0
,
10
,
add
(
x
));
#endif
int
result
=
std
::
accumulate
(
x
,
x
+
10
,
0
);
int
expected
=
(
9
*
10
)
/
2
;
std
::
cout
<<
result
<<
" == "
<<
expected
<<
(
result
==
expected
?
" ok"
:
" ERROR"
)
<<
std
::
endl
;
return
!
(
result
==
expected
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment