ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleTbbMasterRunManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimpleTbbMasterRunManager.hh
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 master model run manager for TBB bases
30 // application.
31 // It is instantiated by user main (or equivalent function) instead
32 // of G4[MT]RunManager. It controls the creation of tbb::tasks.
33 // See G4MTRunManager for documentation of methods relative to base
34 // class. Only class specific methods are documented here.
35 //
36 // Equivalent in traditional MT:
37 // G4MTRunManager
38 //
39 // History:
40 // Nov 4th, 2013 A. Dotti - First Implementation
41 
42 #ifndef SIMPLETBBMASTERRUNMANAGER_HH
43 #define SIMPLETBBMASTERRUNMANAGER_HH
44 
45 #include "G4MTRunManager.hh"
46 #include <tbb/task.h>
47 
49 public:
50  SimpleTbbMasterRunManager(); // G4RunManagerKernel* existingRMK=0);
51  // Default constructor,
52  // tasklist is the tbb::task_list to which the created tasks will be added.
53  // nEvents is the number of events for which each tbb::task is responsible
54  //
56  virtual void RunTermination();
57  void SetTaskList( tbb::task_list* tl ) { theTasks = tl; }
58  //Set a reference to the output task list where new tasks will
59  //be added to
61  //Specify number of events that each simulation task is responsible
62  //for
63 protected:
64  virtual void CreateAndStartWorkers();
65  virtual void TerminateWorkers();
66  virtual void CreateTask(G4int id,G4int evts);
67  //Creates a concrete tbb::task with index id
68  //responsible for evts events
69 protected:
70  //Barriers mechanism for TBB is non existing
71  virtual void WaitForReadyWorkers() {}
72  virtual void WaitForEndEventLoopWorkers() {}
73  virtual void ThisWorkerReady() {}
74  virtual void ThisWorkerEndEventLoop() {}
76  { return WorkerActionRequest::UNDEFINED; }
77  virtual void NewActionRequest( WorkerActionRequest /*newRequest*/ ) {}
78 private:
79  tbb::task_list* theTasks;
81 };
82 
83 #endif //TBBMASTERRUNMANAGER_HH