Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-xt
Commits
130fb97f
Commit
130fb97f
authored
6 years ago
by
Tobias Leibner
Browse files
Options
Downloads
Patches
Plain Diff
[threadstorage] fix compilation and test
parent
114e1583
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/xt/common/parallel/threadstorage.hh
+17
-6
17 additions, 6 deletions
dune/xt/common/parallel/threadstorage.hh
dune/xt/common/test/parallel.cc
+1
-1
1 addition, 1 deletion
dune/xt/common/test/parallel.cc
with
18 additions
and
7 deletions
dune/xt/common/parallel/threadstorage.hh
+
17
−
6
View file @
130fb97f
...
...
@@ -30,7 +30,8 @@ namespace internal {
template
<
class
ValueImp
>
class
EnumerableThreadSpecificWrapper
{
using
BackendType
=
typename
tbb
::
enumerable_thread_specific
<
ValueImp
>
;
// enumerable_thread_specific does not compile with ConstValueType as template param
using
BackendType
=
typename
tbb
::
enumerable_thread_specific
<
std
::
remove_const_t
<
ValueImp
>>
;
public:
using
ValueType
=
ValueImp
;
...
...
@@ -76,6 +77,12 @@ public:
return
values_
.
end
();
}
template
<
class
BinaryOperation
>
ValueType
combine
(
BinaryOperation
op
)
const
{
return
values_
.
combine
(
op
);
}
private
:
mutable
BackendType
values_
;
};
// class EnumerableThreadSpecificWrapper<ValueImp>
...
...
@@ -85,7 +92,7 @@ private:
template
<
class
ValueImp
>
class
EnumerableThreadSpecificWrapper
{
using
BackendType
=
std
::
array
<
ValueImp
,
1
>
;
using
BackendType
=
std
::
array
<
std
::
remove_const_t
<
ValueImp
>
,
1
>
;
public:
using
ValueType
=
ValueImp
;
...
...
@@ -101,7 +108,7 @@ public:
//! Initialization by in-place construction ValueType with \param ctor_args
template
<
class
...
InitTypes
>
explicit
PerThreadValue
(
InitTypes
&&
...
ctor_args
)
explicit
EnumerableThreadSpecificWrapper
(
InitTypes
&&
...
ctor_args
)
:
values_
{
ValueType
(
std
::
forward
<
InitTypes
>
(
ctor_args
)...)}
{
}
...
...
@@ -136,6 +143,12 @@ public:
return
values_
.
end
();
}
template
<
class
BinaryOperation
>
ValueType
combine
(
BinaryOperation
/*op*/
)
const
{
return
values_
[
0
];
}
private
:
BackendType
values_
;
};
// class EnumerableThreadSpecificWrapper<ValueImp>
...
...
@@ -198,9 +211,7 @@ public:
template
<
class
BinaryOperation
>
ValueType
accumulate
(
ValueType
init
,
BinaryOperation
op
)
const
{
typedef
const
typename
ContainerType
::
value_type
ptr
;
auto
l
=
[
&
](
ConstValueType
&
a
,
ptr
&
b
)
{
return
op
(
a
,
*
b
);
};
return
std
::
accumulate
(
values_
.
begin
(),
values_
.
end
(),
init
,
l
);
return
op
(
init
,
values_
.
combine
(
op
));
}
ValueType
sum
()
const
...
...
This diff is collapsed.
Click to expand it.
dune/xt/common/test/parallel.cc
+
1
−
1
View file @
130fb97f
...
...
@@ -80,7 +80,7 @@ TYPED_TEST(ThreadValueTest, All)
typename
PTVType
::
ValueType
value
(
1
);
PTVType
foo
(
value
);
check_eq
(
foo
,
value
);
foo
=
typename
PTVType
::
Value
Type
(
1
);
foo
=
PTV
Type
(
1
);
check_eq
(
foo
,
value
);
const
auto
new_value
=
*
foo
;
const
PTVType
bar
(
*
foo
);
...
...
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