ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SimpleTbbMasterRunManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file SimpleTbbMasterRunManager.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// Class description:
28
//
29
// This class implements the worker model run manager for TBB based
30
// application.
31
// It is instantiated by tbbUserWorkerInitialization and used by
32
// SimpleTbbMasterRunManager.
33
// See G4WorkerRunManager for documentation of methods relative to
34
// base class. Only class specific methods are documented here.
35
//
36
// Equivalent in traditional MT:
37
// G4WorkerRunManager
38
//
39
// History:
40
// Oct 31st, 2013 A. Dotti - First Implementation
41
42
#include "
SimpleTbbMasterRunManager.hh
"
43
#include "
tbbTask.hh
"
44
45
SimpleTbbMasterRunManager::SimpleTbbMasterRunManager
() :
46
G4MTRunManager
(),
47
theTasks(static_cast<tbb::task_list*>(nullptr)),
48
nEvtsPerTask(1)
49
{
50
}
51
52
SimpleTbbMasterRunManager::~SimpleTbbMasterRunManager
()
53
{
54
}
55
56
void
SimpleTbbMasterRunManager::TerminateWorkers
()
57
{
58
//For TBB based example this should be empty
59
}
60
61
void
SimpleTbbMasterRunManager::CreateAndStartWorkers
()
62
{
63
//Instead of pthread based workers, create tbbTask
64
G4int
ntasks =
numberOfEventToBeProcessed
/
nEvtsPerTask
;
65
G4int
remn =
numberOfEventToBeProcessed
%
nEvtsPerTask
;
66
for
(
G4int
nt = 0 ; nt < ntasks ; ++nt )
67
{
68
G4int
evts=
nEvtsPerTask
;
69
if
( nt == ntasks - 1 ) evts+=remn;
70
CreateTask
(nt,evts);
71
}
72
}
73
74
void
SimpleTbbMasterRunManager::CreateTask
(
G4int
id
,
G4int
evts)
75
{
76
tbbTask
& task = *
new
(tbb::task::allocate_root())
77
tbbTask
(
id
,
nullptr
, evts );
//Add output for merging
78
theTasks
->push_back( task );
79
}
80
81
void
SimpleTbbMasterRunManager::RunTermination
()
82
{
83
// Reduce results ....
84
G4MTRunManager::RunTermination
();
85
}
86
geant4
tree
geant4-10.6-release
examples
extended
parallel
TBB
B2b
src
SimpleTbbMasterRunManager.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:09
using
1.8.2 with
ECCE GitHub integration