Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
4509159c
Commit
4509159c
authored
6 years ago
by
Sergey Linev
Committed by
Axel Naumann
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
v7: fix concurrentfill.cxx tutorial
parent
a85bdf0a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/v7/concurrentfill.cxx
+8
-8
8 additions, 8 deletions
tutorials/v7/concurrentfill.cxx
with
8 additions
and
8 deletions
tutorials/v7/concurrentfill.cxx
+
8
−
8
View file @
4509159c
...
...
@@ -16,8 +16,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include
"ROOT/
T
Hist.hxx"
#include
"ROOT/
T
HistConcurrentFill.hxx"
#include
"ROOT/
R
Hist.hxx"
#include
"ROOT/
R
HistConcurrentFill.hxx"
#include
<iostream>
#include
<future>
...
...
@@ -33,7 +33,7 @@ double wasteCPUTime(std::mt19937 &gen)
std
::
generate_canonical
<
double
,
100
>
(
gen
);
}
using
Filler_t
=
Experimental
::
T
HistConcurrentFiller
<
Experimental
::
T
H2D
,
1024
>
;
using
Filler_t
=
Experimental
::
R
HistConcurrentFiller
<
Experimental
::
R
H2D
,
1024
>
;
/// This function is called within each thread: it spends some CPU time and then
/// fills a number into the histogram, through the Filler_t. This is repeated
...
...
@@ -47,15 +47,15 @@ void theTask(Filler_t filler)
}
/// This example fills a histogram concurrently, from several threads.
void
concurrentHistFill
(
Experimental
::
T
H2D
&
hist
)
void
concurrentHistFill
(
Experimental
::
R
H2D
&
hist
)
{
//
T
HistConcurrentFillManager allows multiple threads to fill the histogram
//
R
HistConcurrentFillManager allows multiple threads to fill the histogram
// concurrently.
//
// Details: each thread's Fill() calls are buffered. once the buffer is full,
// the
T
HistConcurrentFillManager locks and flushes the buffer into the
// the
R
HistConcurrentFillManager locks and flushes the buffer into the
// histogram.
Experimental
::
T
HistConcurrentFillManager
<
Experimental
::
T
H2D
>
fillMgr
(
hist
);
Experimental
::
R
HistConcurrentFillManager
<
Experimental
::
R
H2D
>
fillMgr
(
hist
);
std
::
array
<
std
::
thread
,
8
>
threads
;
...
...
@@ -73,7 +73,7 @@ void concurrentHistFill(Experimental::TH2D &hist)
void
concurrentfill
()
{
// This histogram will be filled from several threads.
Experimental
::
T
H2D
hist
{{
100
,
0.
,
1.
},
{{
0.
,
1.
,
2.
,
3.
,
10.
}}};
Experimental
::
R
H2D
hist
{{
100
,
0.
,
1.
},
{{
0.
,
1.
,
2.
,
3.
,
10.
}}};
concurrentHistFill
(
hist
);
...
...
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