Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TaskRunManager Class Reference

#include <G4TaskRunManager.hh>

+ Inheritance diagram for G4TaskRunManager:

Public Types

using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Run >
 
using InitializeSeedsCallback = std::function< G4bool(G4int, G4int &, G4int &)>
 
using RunTaskGroup = G4TaskGroup< void >
 
- Public Types inherited from G4MTRunManager
enum class  WorkerActionRequest { UNDEFINED , NEXTITERATION , PROCESSUI , ENDWORKER }
 
using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Run >
 
using masterWorlds_t = std::map< G4int, G4VPhysicalVolume * >
 
- Public Types inherited from G4RunManager
enum  RMType { sequentialRM , masterRM , workerRM }
 
using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Run >
 
- Public Types inherited from PTL::TaskRunManager
using pointer = TaskRunManager *
 

Public Member Functions

 G4TaskRunManager (G4bool useTBB=G4GetEnv< G4bool >("G4USE_TBB", false))
 
 G4TaskRunManager (G4VUserTaskQueue *taskQueue, G4bool useTBB=G4GetEnv< G4bool >("G4USE_TBB", false), G4int evtGrainsize=0)
 
virtual ~G4TaskRunManager ()
 
void SetGrainsize (G4int n)
 
G4int GetGrainsize () const
 
G4int GetNumberOfTasks () const
 
G4int GetNumberOfEventsPerTask () const
 
virtual void SetNumberOfThreads (G4int n) override
 
virtual G4int GetNumberOfThreads () const override
 
virtual size_t GetNumberActiveThreads () const override
 
virtual void Initialize () override
 
virtual void InitializeEventLoop (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1) override
 
virtual void InitializeThreadPool () override
 
G4bool ThreadPoolIsInitialized () const
 
virtual void Initialize (uint64_t nthreads) override
 
virtual void TerminateOneEvent () override
 
virtual void ProcessOneEvent (G4int i_event) override
 
virtual void ConstructScoringWorlds () override
 
virtual void RunTermination () override
 
virtual G4bool SetUpAnEvent (G4Event *, G4long &s1, G4long &s2, G4long &s3, G4bool reseedRequired=true) override
 
virtual G4int SetUpNEvents (G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true) override
 
void MergeScores (const G4ScoringManager *localScoringManager)
 
void MergeRun (const G4Run *localRun)
 
virtual void RequestWorkersProcessCommandsStack () override
 
virtual void ThisWorkerProcessCommandsStackDone () override
 
virtual void WaitForReadyWorkers () override
 
virtual void WaitForEndEventLoopWorkers () override
 
virtual void ThisWorkerReady () override
 
virtual void ThisWorkerEndEventLoop () override
 
virtual WorkerActionRequest ThisWorkerWaitForNextAction () override
 
void SetInitializeSeedsCallback (InitializeSeedsCallback f)
 
virtual void AbortRun (G4bool softAbort=false) override
 
virtual void AbortEvent () override
 
- Public Member Functions inherited from G4MTRunManager
 G4MTRunManager ()
 
virtual ~G4MTRunManager ()
 
virtual void SetNumberOfThreads (G4int n)
 
virtual G4int GetNumberOfThreads () const
 
void SetPinAffinity (G4int n=1)
 
G4int GetPinAffinity () const
 
virtual void Initialize ()
 
virtual void InitializeEventLoop (G4int n_event, const char *macroFile=0, G4int n_select=-1)
 
virtual void InitializeThreadPool ()
 
virtual void TerminateOneEvent ()
 
virtual void ProcessOneEvent (G4int i_event)
 
virtual void ConstructScoringWorlds ()
 
virtual void RunTermination ()
 
virtual G4bool SetUpAnEvent (G4Event *, long &s1, long &s2, long &s3, G4bool reseedRequired=true)
 
virtual G4int SetUpNEvents (G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true)
 
std::vector< G4StringGetCommandStack ()
 
virtual size_t GetNumberActiveThreads () const
 
virtual void ThisWorkerReady ()
 
virtual void ThisWorkerEndEventLoop ()
 
const CLHEP::HepRandomEnginegetMasterRandomEngine () const
 
virtual void SetUserInitialization (G4VUserPhysicsList *userPL)
 
virtual void SetUserInitialization (G4VUserDetectorConstruction *userDC)
 
virtual void SetUserInitialization (G4UserWorkerInitialization *userInit)
 
virtual void SetUserInitialization (G4UserWorkerThreadInitialization *userInit)
 
virtual void SetUserInitialization (G4VUserActionInitialization *userInit)
 
virtual void SetUserAction (G4UserRunAction *userAction)
 
virtual void SetUserAction (G4VUserPrimaryGeneratorAction *userAction)
 
virtual void SetUserAction (G4UserEventAction *userAction)
 
virtual void SetUserAction (G4UserStackingAction *userAction)
 
virtual void SetUserAction (G4UserTrackingAction *userAction)
 
virtual void SetUserAction (G4UserSteppingAction *userAction)
 
void MergeScores (const G4ScoringManager *localScoringManager)
 
void MergeRun (const G4Run *localRun)
 
virtual void RequestWorkersProcessCommandsStack ()
 
virtual void ThisWorkerProcessCommandsStackDone ()
 
virtual WorkerActionRequest ThisWorkerWaitForNextAction ()
 
void SetEventModulo (G4int i=1)
 
G4int GetEventModulo () const
 
virtual void AbortRun (G4bool softAbort=false)
 
virtual void AbortEvent ()
 
- Public Member Functions inherited from G4RunManager
 G4RunManager ()
 
virtual ~G4RunManager ()
 
 G4RunManager (const G4RunManager &)=delete
 
G4RunManageroperator= (const G4RunManager &)=delete
 
virtual void BeamOn (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
virtual void Initialize ()
 
virtual void DefineWorldVolume (G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
virtual void AbortRun (G4bool softAbort=false)
 
virtual void AbortEvent ()
 
virtual void InitializeGeometry ()
 
virtual void InitializePhysics ()
 
virtual G4bool ConfirmBeamOnCondition ()
 
virtual void RunInitialization ()
 
virtual void DoEventLoop (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
virtual void RunTermination ()
 
virtual void InitializeEventLoop (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
virtual void ProcessOneEvent (G4int i_event)
 
virtual void TerminateOneEvent ()
 
virtual void TerminateEventLoop ()
 
virtual G4EventGenerateEvent (G4int i_event)
 
virtual void AnalyzeEvent (G4Event *anEvent)
 
virtual void ConfigureProfilers (const std::vector< std::string > &args={})
 
void ConfigureProfilers (G4int argc, char **argv)
 
virtual void SetNumberOfThreads (G4int)
 
virtual G4int GetNumberOfThreads () const
 
void DumpRegion (const G4String &rname) const
 
void DumpRegion (G4Region *region=nullptr) const
 
void GeometryHasBeenModified (G4bool prop=true)
 
void ReinitializeGeometry (G4bool destroyFirst=false, G4bool prop=true)
 
void PhysicsHasBeenModified ()
 
void CutOffHasBeenModified ()
 
void ReOptimizeMotherOf (G4VPhysicalVolume *)
 
void ReOptimize (G4LogicalVolume *)
 
void SetGeometryToBeOptimized (G4bool vl)
 
G4bool GetGeometryToBeOptimized ()
 
void GeometryDirectlyUpdated (G4bool val=true)
 
virtual void ConstructScoringWorlds ()
 
virtual void rndmSaveThisRun ()
 
virtual void rndmSaveThisEvent ()
 
virtual void RestoreRandomNumberStatus (const G4String &fileN)
 
virtual void RestoreRndmEachEvent (G4bool)
 
virtual void SetUserInitialization (G4VUserDetectorConstruction *userInit)
 
virtual void SetUserInitialization (G4VUserPhysicsList *userInit)
 
virtual void SetUserInitialization (G4VUserActionInitialization *userInit)
 
virtual void SetUserInitialization (G4UserWorkerInitialization *userInit)
 
virtual void SetUserInitialization (G4UserWorkerThreadInitialization *userInit)
 
virtual void SetUserAction (G4UserRunAction *userAction)
 
virtual void SetUserAction (G4VUserPrimaryGeneratorAction *userAction)
 
virtual void SetUserAction (G4UserEventAction *userAction)
 
virtual void SetUserAction (G4UserStackingAction *userAction)
 
virtual void SetUserAction (G4UserTrackingAction *userAction)
 
virtual void SetUserAction (G4UserSteppingAction *userAction)
 
const G4VUserDetectorConstructionGetUserDetectorConstruction () const
 
const G4VUserPhysicsListGetUserPhysicsList () const
 
const G4VUserActionInitializationGetUserActionInitialization () const
 
G4VUserActionInitializationGetNonConstUserActionInitialization () const
 
const G4UserWorkerInitializationGetUserWorkerInitialization () const
 
const G4UserWorkerThreadInitializationGetUserWorkerThreadInitialization () const
 
const G4UserRunActionGetUserRunAction () const
 
const G4VUserPrimaryGeneratorActionGetUserPrimaryGeneratorAction () const
 
const G4UserEventActionGetUserEventAction () const
 
const G4UserStackingActionGetUserStackingAction () const
 
const G4UserTrackingActionGetUserTrackingAction () const
 
const G4UserSteppingActionGetUserSteppingAction () const
 
void SetNumberOfAdditionalWaitingStacks (G4int iAdd)
 
const G4StringGetVersionString () const
 
void SetPrimaryTransformer (G4PrimaryTransformer *pt)
 
void StoreRandomNumberStatusToG4Event (G4int vl)
 
G4int GetFlagRandomNumberStatusToG4Event () const
 
void SetRandomNumberStore (G4bool flag)
 
G4bool GetRandomNumberStore () const
 
void SetRandomNumberStoreDir (const G4String &dir)
 
const G4StringGetRandomNumberStoreDir () const
 
const G4StringGetRandomNumberStatusForThisRun () const
 
const G4StringGetRandomNumberStatusForThisEvent () const
 
void SetRandomNumberStorePerEvent (G4bool flag)
 
G4bool GetRandomNumberStorePerEvent () const
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
G4int GetPrintProgress ()
 
void SetPrintProgress (G4int i)
 
void SetNumberOfEventsToBeStored (G4int val)
 
const G4RunGetCurrentRun () const
 
G4RunGetNonConstCurrentRun () const
 
const G4EventGetCurrentEvent () const
 
const G4EventGetPreviousEvent (G4int i) const
 
void SetRunIDCounter (G4int i)
 
G4int GetNumberOfParallelWorld () const
 
void SetNumberOfEventsToBeProcessed (G4int val)
 
G4int GetNumberOfEventsToBeProcessed () const
 
G4int GetNumberOfSelectEvents () const
 
const G4StringGetSelectMacro () const
 
void SetDCtable (G4DCtable *DCtbl)
 
RMType GetRunManagerType () const
 
- Public Member Functions inherited from PTL::TaskRunManager
 TaskRunManager (bool useTBB=false)
 
virtual ~TaskRunManager ()
 
virtual int GetNumberOfThreads () const
 
virtual size_t GetNumberActiveThreads () const
 
virtual void Initialize (uint64_t n=std::thread::hardware_concurrency())
 
virtual void Terminate ()
 
ThreadPoolGetThreadPool () const
 
TaskManagerGetTaskManager () const
 
bool IsInitialized () const
 
int GetVerbose () const
 
void SetVerbose (int val)
 

Static Public Member Functions

static G4ThreadId GetMasterThreadId ()
 
static G4TaskRunManagerGetMasterRunManager ()
 
static G4TaskRunManagerKernelGetMTMasterRunManagerKernel ()
 
- Static Public Member Functions inherited from G4MTRunManager
static G4ThreadId GetMasterThreadId ()
 
static G4ScoringManagerGetMasterScoringManager ()
 
static masterWorlds_tGetMasterWorlds ()
 
static void addWorld (G4int counter, G4VPhysicalVolume *w)
 
static G4MTRunManagerGetMasterRunManager ()
 
static G4RunManagerKernelGetMasterRunManagerKernel ()
 
static G4MTRunManagerKernelGetMTMasterRunManagerKernel ()
 
static G4int SeedOncePerCommunication ()
 
static void SetSeedOncePerCommunication (G4int val)
 
static G4ThreadId GetMasterTheadId ()
 
- Static Public Member Functions inherited from G4RunManager
static G4RunManagerGetRunManager ()
 
static G4bool IfGeometryHasBeenDestroyed ()
 
- Static Public Member Functions inherited from PTL::TaskRunManager
static TaskRunManagerGetInstance (bool useTBB=false)
 
static TaskRunManagerGetMasterRunManager (bool useTBB=false)
 

Protected Member Functions

virtual void ComputeNumberOfTasks ()
 
virtual G4bool InitializeSeeds (G4int) override
 
virtual void RefillSeeds () override
 
virtual void StoreRNGStatus (const G4String &filenamePrefix) override
 
virtual void CreateAndStartWorkers () override
 
virtual void TerminateWorkers () override
 
virtual void NewActionRequest (WorkerActionRequest) override
 
virtual void AddEventTask (G4int)
 
- Protected Member Functions inherited from G4MTRunManager
virtual G4bool InitializeSeeds (G4int)
 
virtual void PrepareCommandsStack ()
 
virtual void StoreRNGStatus (const G4String &filenamePrefix)
 
virtual void rndmSaveThisRun ()
 
virtual void rndmSaveThisEvent ()
 
virtual void CreateAndStartWorkers ()
 
virtual void WaitForReadyWorkers ()
 
virtual void WaitForEndEventLoopWorkers ()
 
virtual void TerminateWorkers ()
 
virtual void NewActionRequest (WorkerActionRequest newRequest)
 
virtual void RefillSeeds ()
 
- Protected Member Functions inherited from G4RunManager
 G4RunManager (RMType rmType)
 
void CleanUpPreviousEvents ()
 
void CleanUpUnnecessaryEvents (G4int keepNEvents)
 
void StackPreviousEvent (G4Event *anEvent)
 
virtual void StoreRNGStatus (const G4String &filenamePrefix)
 
void UpdateScoring ()
 
virtual void DeleteUserInitializations ()
 

Protected Attributes

RunTaskGroupworkTaskGroup = nullptr
 
G4boolpoolInitialized = PTL::TaskRunManager::m_is_initialized
 
G4ThreadPool *& threadPool = PTL::TaskRunManager::m_thread_pool
 
G4VUserTaskQueue *& taskQueue = PTL::TaskRunManager::m_task_queue
 
G4TaskManager *& taskManager = PTL::TaskRunManager::m_task_manager
 
InitializeSeedsCallback initSeedsCallback
 
- Protected Attributes inherited from G4MTRunManager
G4int nworkers = 2
 
G4int forcedNwokers = -1
 
G4int numberOfEventToBeProcessed = 0
 
WorkerActionRequest nextActionRequest = WorkerActionRequest::UNDEFINED
 
G4int eventModuloDef = 0
 
G4int eventModulo = 1
 
G4int nSeedsUsed = 0
 
G4int nSeedsFilled = 0
 
G4int nSeedsMax = 10000
 
G4int nSeedsPerEvent = 2
 
G4doublerandDbl = nullptr
 
G4MTBarrier beginOfEventLoopBarrier
 
G4MTBarrier endOfEventLoopBarrier
 
G4MTBarrier nextActionRequestBarrier
 
G4MTBarrier processUIBarrier
 
- Protected Attributes inherited from G4RunManager
G4RunManagerKernelkernel = nullptr
 
G4EventManagereventManager = nullptr
 
G4VUserDetectorConstructionuserDetector = nullptr
 
G4VUserPhysicsListphysicsList = nullptr
 
G4VUserActionInitializationuserActionInitialization = nullptr
 
G4UserWorkerInitializationuserWorkerInitialization = nullptr
 
G4UserWorkerThreadInitializationuserWorkerThreadInitialization = nullptr
 
G4UserRunActionuserRunAction = nullptr
 
G4VUserPrimaryGeneratorActionuserPrimaryGeneratorAction = nullptr
 
G4UserEventActionuserEventAction = nullptr
 
G4UserStackingActionuserStackingAction = nullptr
 
G4UserTrackingActionuserTrackingAction = nullptr
 
G4UserSteppingActionuserSteppingAction = nullptr
 
G4bool geometryInitialized = false
 
G4bool physicsInitialized = false
 
G4bool runAborted = false
 
G4bool initializedAtLeastOnce = false
 
G4bool geometryToBeOptimized = true
 
G4int runIDCounter = 0
 
G4int verboseLevel = 0
 
G4int printModulo = -1
 
G4Timertimer = nullptr
 
G4DCtableDCtable = nullptr
 
G4RuncurrentRun = nullptr
 
G4EventcurrentEvent = nullptr
 
std::list< G4Event * > * previousEvents = nullptr
 
G4int n_perviousEventsToBeStored = 0
 
G4int numberOfEventToBeProcessed = 0
 
G4bool storeRandomNumberStatus = false
 
G4int storeRandomNumberStatusToG4Event = 0
 
G4String randomNumberStatusDir = "./"
 
G4String randomNumberStatusForThisRun = ""
 
G4String randomNumberStatusForThisEvent = ""
 
G4bool rngStatusEventsFlag = false
 
G4VPhysicalVolumecurrentWorld = nullptr
 
G4int nParallelWorlds = 0
 
G4String msgText = " "
 
G4int n_select_msg = -1
 
G4int numberOfEventProcessed = 0
 
G4String selectMacro = ""
 
G4bool fakeRun = false
 
G4bool isScoreNtupleWriter = false
 
G4bool geometryDirectlyUpdated = false
 
RMType runManagerType
 
- Protected Attributes inherited from PTL::TaskRunManager
bool m_is_initialized = false
 
int m_verbose = 0
 
uint64_t m_workers = 0
 
VUserTaskQueuem_task_queue = nullptr
 
ThreadPoolm_thread_pool = nullptr
 
TaskManagerm_task_manager = nullptr
 

Friends

class G4RunManagerFactory
 

Additional Inherited Members

- Static Protected Attributes inherited from G4MTRunManager
static G4MTRUN_DLL G4ScoringManagermasterScM = nullptr
 
static G4MTRUN_DLL masterWorlds_t masterWorlds = G4MTRunManager::masterWorlds_t()
 
static G4MTRUN_DLL G4MTRunManagerfMasterRM = nullptr
 
static G4ThreadId masterThreadId = G4ThisThread::get_id()
 
static G4int seedOncePerCommunication = 0
 
- Static Protected Attributes inherited from G4RunManager
static G4RUN_DLL G4bool fGeometryHasBeenDestroyed = false
 

Detailed Description

Definition at line 66 of file G4TaskRunManager.hh.

Member Typedef Documentation

◆ InitializeSeedsCallback

Definition at line 77 of file G4TaskRunManager.hh.

◆ ProfilerConfig

◆ RunTaskGroup

Definition at line 78 of file G4TaskRunManager.hh.

Constructor & Destructor Documentation

◆ G4TaskRunManager() [1/2]

G4TaskRunManager::G4TaskRunManager ( G4bool  useTBB = G4GetEnv<G4bool>("G4USE_TBB", false))

Definition at line 162 of file G4TaskRunManager.cc.

163 : G4TaskRunManager(nullptr, useTBB, 0)
164{}

◆ G4TaskRunManager() [2/2]

G4TaskRunManager::G4TaskRunManager ( G4VUserTaskQueue taskQueue,
G4bool  useTBB = G4GetEnv<G4bool>("G4USE_TBB", false),
G4int  evtGrainsize = 0 
)

Definition at line 77 of file G4TaskRunManager.cc.

80 , PTL::TaskRunManager(useTBB)
81 , eventGrainsize(grainsize)
82 , numberOfEventsPerTask(-1)
83 , numberOfTasks(-1)
84 , masterRNGEngine(nullptr)
85 , workTaskGroup(nullptr)
86{
87 if(task_queue)
88 taskQueue = task_queue;
89
90 // override default of 2 from G4MTRunManager
92 fMasterRM = this;
93 MTkernel = static_cast<G4TaskRunManagerKernel*>(kernel);
94
95 G4int numberOfStaticAllocators = kernel->GetNumberOfStaticAllocators();
96 if(numberOfStaticAllocators > 0)
97 {
99 msg1 << "There are " << numberOfStaticAllocators
100 << " static G4Allocator objects detected.\n"
101 << "In multi-threaded mode, all G4Allocator objects must "
102 << "be dynamicly instantiated.";
103 G4Exception("G4TaskRunManager::G4TaskRunManager", "Run1035", FatalException,
104 msg1);
105 }
106
109
110 // use default RandomNumberGenerator if created by user, or create default
111 masterRNGEngine = G4Random::getTheEngine();
112
115
116 //------------------------------------------------------------------------//
117 // handle threading
118 //------------------------------------------------------------------------//
119 G4String _nthread_env = G4GetEnv<G4String>("G4FORCENUMBEROFTHREADS", "");
120 for(auto& itr : _nthread_env)
121 itr = (char)std::tolower(itr);
122
123 if(_nthread_env == "max")
125 else if(!_nthread_env.empty())
126 {
127 std::stringstream ss;
128 G4int _nthread_val = -1;
129 ss << _nthread_env;
130 ss >> _nthread_val;
131 if(_nthread_val > 0)
132 forcedNwokers = _nthread_val;
133
134 if(forcedNwokers > 0)
136 }
137
138 //------------------------------------------------------------------------//
139 // option for forcing TBB
140 //------------------------------------------------------------------------//
141#ifdef GEANT4_USE_TBB
142 G4int _useTBB = G4GetEnv<G4int>("G4FORCE_TBB", (G4int) useTBB);
143 if(_useTBB > 0)
144 useTBB = true;
145#else
146 if(useTBB)
147 {
149 msg << "TBB was requested but Geant4 was not built with TBB support";
150 G4Exception("G4TaskRunManager::G4TaskRunManager(...)", "Run0131",
151 JustWarning, msg);
152 }
153 useTBB = false;
154#endif
155
156 // handle TBB
158}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4int numberOfEventToBeProcessed
static G4MTRUN_DLL G4ScoringManager * masterScM
static G4MTRUN_DLL G4MTRunManager * fMasterRM
G4double * randDbl
G4int GetNumberOfStaticAllocators() const
G4RunManagerKernel * kernel
static G4ScoringManager * GetScoringManagerIfExist()
G4VUserTaskQueue *& taskQueue
RunTaskGroup * workTaskGroup
void SetMasterUIManager(G4bool val)
Definition: G4UImanager.hh:219
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
static void set_use_tbb(bool _v)
Definition: ThreadPool.cc:159
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:121

◆ ~G4TaskRunManager()

G4TaskRunManager::~G4TaskRunManager ( )
virtual

Definition at line 168 of file G4TaskRunManager.cc.

169{
170 // finalize profiler before shutting down the threads
172
173 // terminate all the workers
175
176 // trigger all G4AutoDelete instances
178
179 // delete the task-group
180 delete workTaskGroup;
181 workTaskGroup = nullptr;
182
183 // destroy the thread-pool
184 if(threadPool)
186
188}
static void Finalize()
Definition: G4Profiler.cc:331
virtual void TerminateWorkers() override
G4ThreadPool *& threadPool
virtual void Terminate()
size_type destroy_threadpool()
Definition: ThreadPool.cc:572

Member Function Documentation

◆ AbortEvent()

void G4TaskRunManager::AbortEvent ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 753 of file G4TaskRunManager.cc.

754{
755 // nothing to do in the master thread
756}

◆ AbortRun()

void G4TaskRunManager::AbortRun ( G4bool  softAbort = false)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 735 of file G4TaskRunManager.cc.

736{
737 // This method is valid only for GeomClosed or EventProc state
738 G4ApplicationState currentState =
740 if(currentState == G4State_GeomClosed || currentState == G4State_EventProc)
741 {
742 runAborted = true;
743 MTkernel->BroadcastAbortRun(softAbort);
744 }
745 else
746 {
747 G4cerr << "Run is not in progress. AbortRun() ignored." << G4endl;
748 }
749}
G4ApplicationState
@ G4State_EventProc
@ G4State_GeomClosed
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4bool runAborted
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
void BroadcastAbortRun(G4bool softAbort)

◆ AddEventTask()

void G4TaskRunManager::AddEventTask ( G4int  nt)
protectedvirtual

Definition at line 472 of file G4TaskRunManager.cc.

473{
474 if(verboseLevel > 1)
475 G4cout << "Adding task " << nt << " to task-group..." << G4endl;
477}
G4GLOB_DLL std::ostream G4cout
G4int verboseLevel
enable_if_t< std::is_void< Up >::value, void > exec(Func func, Args... args)
Definition: TaskGroup.hh:531

Referenced by CreateAndStartWorkers().

◆ ComputeNumberOfTasks()

void G4TaskRunManager::ComputeNumberOfTasks ( )
protectedvirtual

Definition at line 311 of file G4TaskRunManager.cc.

312{
313 G4int grainSize = (eventGrainsize == 0)
314 ? (G4int)threadPool->size() : eventGrainsize;
315 grainSize =
316 G4GetEnv<G4int>("G4FORCE_GRAINSIZE", grainSize, "Forcing grainsize...");
317 if(grainSize == 0)
318 grainSize = 1;
319
320 G4int nEvtsPerTask = (numberOfEventToBeProcessed > grainSize)
321 ? (numberOfEventToBeProcessed / grainSize)
322 : 1;
323
324 if(eventModuloDef > 0)
325 {
327 }
328 else
329 {
331 if(eventModulo < 1)
332 eventModulo = 1;
333 }
334 if(eventModulo > nEvtsPerTask)
335 {
336 G4int oldMod = eventModulo;
337 eventModulo = nEvtsPerTask;
338
340 msgd << "Event modulo is reduced to " << eventModulo << " (was " << oldMod
341 << ")"
342 << " to distribute events to all threads.";
343 G4Exception("G4TaskRunManager::InitializeEventLoop()", "Run10035",
344 JustWarning, msgd);
345 }
346 nEvtsPerTask = eventModulo;
347
348 if(fakeRun)
349 nEvtsPerTask = G4GetEnv<G4int>(
350 "G4FORCE_EVENTS_PER_TASK", nEvtsPerTask,
351 "Forcing number of events per task (overrides grainsize)...");
352 else
353 nEvtsPerTask = G4GetEnv<G4int>("G4FORCE_EVENTS_PER_TASK", nEvtsPerTask);
354
355 if(nEvtsPerTask < 1)
356 nEvtsPerTask = 1;
357
358 numberOfTasks = numberOfEventToBeProcessed / nEvtsPerTask;
359 numberOfEventsPerTask = nEvtsPerTask;
360 eventModulo = numberOfEventsPerTask;
361
362 if(fakeRun && verboseLevel > 1)
363 {
364 std::stringstream msg;
365 msg << "--> G4TaskRunManager::ComputeNumberOfTasks() --> " << numberOfTasks
366 << " tasks with " << numberOfEventsPerTask << " events/task...";
367
368 std::stringstream ss;
369 ss.fill('=');
370 ss << std::setw((G4int)msg.str().length()) << "";
371 G4cout << "\n"
372 << ss.str() << "\n"
373 << msg.str() << "\n"
374 << ss.str() << "\n"
375 << G4endl;
376 }
377}
size_type size() const
Definition: ThreadPool.hh:252

Referenced by CreateAndStartWorkers(), and InitializeEventLoop().

◆ ConstructScoringWorlds()

void G4TaskRunManager::ConstructScoringWorlds ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 614 of file G4TaskRunManager.cc.

615{
617 // Call base class stuff...
619
620 masterWorlds.clear();
621 G4int nWorlds = (G4int)
623 std::vector<G4VPhysicalVolume*>::iterator itrW =
625 for(G4int iWorld = 0; iWorld < nWorlds; ++iWorld)
626 {
627 addWorld(iWorld, *itrW);
628 ++itrW;
629 }
630}
static void addWorld(G4int counter, G4VPhysicalVolume *w)
static G4MTRUN_DLL masterWorlds_t masterWorlds
virtual void ConstructScoringWorlds()
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const

◆ CreateAndStartWorkers()

void G4TaskRunManager::CreateAndStartWorkers ( )
overrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 381 of file G4TaskRunManager.cc.

382{
383 // Now loop on requested number of workers
384 // This will also start the workers
385 // Currently we do not allow to change the
386 // number of threads: threads area created once
387 // Instead of pthread based workers, create tbbTask
388 static bool initializeStarted = false;
389
391
392 if(fakeRun)
393 {
394 if(initializeStarted)
395 {
396 auto initCmdStack = GetCommandStack();
397 if(!initCmdStack.empty())
398 {
399 threadPool->execute_on_all_threads([initCmdStack]() {
400 for(auto& itr : initCmdStack)
401 G4UImanager::GetUIpointer()->ApplyCommand(itr);
403 });
404 }
405 }
406 else
407 {
408 std::stringstream msg;
409 msg << "--> G4TaskRunManager::CreateAndStartWorkers() --> "
410 << "Initializing workers...";
411
412 std::stringstream ss;
413 ss.fill('=');
414 ss << std::setw((G4int)msg.str().length()) << "";
415 G4cout << "\n"
416 << ss.str() << "\n"
417 << msg.str() << "\n"
418 << ss.str() << "\n"
419 << G4endl;
420
424 }
425 initializeStarted = true;
426 }
427 else
428 {
429 auto initCmdStack = GetCommandStack();
430 if(!initCmdStack.empty())
431 {
432 threadPool->execute_on_all_threads([initCmdStack]() {
433 for(auto& itr : initCmdStack)
434 G4UImanager::GetUIpointer()->ApplyCommand(itr);
435 });
436 }
437
438 // cleans up a previous run and events in case a thread
439 // does not execute any tasks
442
443 {
444 std::stringstream msg;
445 msg << "--> G4TaskRunManager::CreateAndStartWorkers() --> "
446 << "Creating " << numberOfTasks << " tasks with "
447 << numberOfEventsPerTask << " events/task...";
448
449 std::stringstream ss;
450 ss.fill('=');
451 ss << std::setw((G4int)msg.str().length()) << "";
452 G4cout << "\n"
453 << ss.str() << "\n"
454 << msg.str() << "\n"
455 << ss.str() << "\n"
456 << G4endl;
457 }
458
460 for(G4int nt = 0; nt < numberOfTasks + 1; ++nt)
461 {
462 if(remaining > 0)
463 AddEventTask(nt);
464 remaining -= numberOfEventsPerTask;
465 }
467 }
468}
std::vector< G4String > GetCommandStack()
static std::vector< G4String > & InitCommandStack()
virtual void AddEventTask(G4int)
virtual void ComputeNumberOfTasks()
virtual void DoWork() override
static G4WorkerTaskRunManager * GetWorkerRunManager()
void execute_on_all_threads(FuncT &&_func)
Definition: ThreadPool.hh:493

Referenced by InitializeEventLoop().

◆ GetGrainsize()

G4int G4TaskRunManager::GetGrainsize ( ) const
inline

Definition at line 93 of file G4TaskRunManager.hh.

93{ return eventGrainsize; }

◆ GetMasterRunManager()

◆ GetMasterThreadId()

G4ThreadId G4TaskRunManager::GetMasterThreadId ( )
static

Definition at line 192 of file G4TaskRunManager.cc.

193{
195}
static G4ThreadId GetMasterThreadId()

◆ GetMTMasterRunManagerKernel()

G4TaskRunManagerKernel * G4TaskRunManager::GetMTMasterRunManagerKernel ( )
static

Definition at line 70 of file G4TaskRunManager.cc.

71{
72 return GetMasterRunManager()->MTkernel;
73}
static G4TaskRunManager * GetMasterRunManager()

◆ GetNumberActiveThreads()

virtual size_t G4TaskRunManager::GetNumberActiveThreads ( ) const
inlineoverridevirtual

Reimplemented from PTL::TaskRunManager.

Definition at line 105 of file G4TaskRunManager.hh.

106 {
108 }
virtual size_t GetNumberActiveThreads() const

◆ GetNumberOfEventsPerTask()

G4int G4TaskRunManager::GetNumberOfEventsPerTask ( ) const
inline

Definition at line 95 of file G4TaskRunManager.hh.

96 {
97 return numberOfEventsPerTask;
98 }

◆ GetNumberOfTasks()

G4int G4TaskRunManager::GetNumberOfTasks ( ) const
inline

Definition at line 94 of file G4TaskRunManager.hh.

94{ return numberOfTasks; }

◆ GetNumberOfThreads()

virtual G4int G4TaskRunManager::GetNumberOfThreads ( ) const
inlineoverridevirtual

Reimplemented from PTL::TaskRunManager.

Definition at line 101 of file G4TaskRunManager.hh.

102 {
104 }
virtual int GetNumberOfThreads() const

◆ Initialize() [1/2]

void G4TaskRunManager::Initialize ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 242 of file G4TaskRunManager.cc.

243{
244 G4bool firstTime = (!threadPool);
245 if(firstTime)
247
249
250 // make sure all worker threads are set up.
252 if(firstTime)
254 // G4UImanager::GetUIpointer()->SetIgnoreCmdNotFound(true);
255}
bool G4bool
Definition: G4Types.hh:86
virtual void Initialize()
void SetRunIDCounter(G4int i)
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
virtual void InitializeThreadPool() override

◆ Initialize() [2/2]

virtual void G4TaskRunManager::Initialize ( uint64_t  nthreads)
inlineoverridevirtual

Reimplemented from PTL::TaskRunManager.

Definition at line 120 of file G4TaskRunManager.hh.

121 {
123 }
virtual void Initialize(uint64_t n=std::thread::hardware_concurrency())

◆ InitializeEventLoop()

void G4TaskRunManager::InitializeEventLoop ( G4int  n_event,
const char *  macroFile = nullptr,
G4int  n_select = -1 
)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 509 of file G4TaskRunManager.cc.

511{
512 MTkernel->SetUpDecayChannels();
515
516 if(!fakeRun)
517 {
518 nSeedsUsed = 0;
519 nSeedsFilled = 0;
520
521 if(verboseLevel > 0)
522 timer->Start();
523
524 n_select_msg = n_select;
525 if(macroFile != nullptr)
526 {
527 if(n_select_msg < 0)
528 n_select_msg = n_event;
529
530 msgText = "/control/execute ";
531 msgText += macroFile;
532 selectMacro = macroFile;
533 }
534 else
535 {
536 n_select_msg = -1;
537 selectMacro = "";
538 }
539
541
542 // initialize seeds
543 // If user did not implement InitializeSeeds,
544 // use default: nSeedsPerEvent seeds per event
545
546 if(n_event > 0)
547 {
548 G4bool _overload = InitializeSeeds(n_event);
549 G4bool _functor = false;
550 if(!_overload)
551 _functor = initSeedsCallback(n_event, nSeedsPerEvent, nSeedsFilled);
552 if(_overload == false && _functor == false)
553 {
556 {
557 case 0:
558 nSeedsFilled = n_event;
559 break;
560 case 1:
561 nSeedsFilled = numberOfTasks;
562 break;
563 case 2:
564 nSeedsFilled = n_event / eventModulo + 1;
565 break;
566 default:
568 msgd << "Parameter value <" << SeedOncePerCommunication()
569 << "> of seedOncePerCommunication is invalid. It is reset "
570 "to 0.";
571 G4Exception("G4TaskRunManager::InitializeEventLoop()", "Run10036",
572 JustWarning, msgd);
574 nSeedsFilled = n_event;
575 }
576
577 // Generates up to nSeedsMax seed pairs only.
580 masterRNGEngine->flatArray(nSeedsPerEvent * nSeedsFilled, randDbl);
581 helper->Fill(randDbl, nSeedsFilled, n_event, nSeedsPerEvent);
582 }
583 }
584 }
585
586 // Now initialize workers. Check if user defined a WorkerThreadInitialization
587 if(userWorkerThreadInitialization == nullptr)
589
590 // Prepare UI commands for threads
592
593 // Start worker threads
595}
virtual void flatArray(const int size, double *vect)=0
static G4int SeedOncePerCommunication()
static void SetSeedOncePerCommunication(G4int val)
virtual void PrepareCommandsStack()
G4Timer * timer
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
G4int n_select_msg
G4int numberOfEventProcessed
G4String msgText
G4String selectMacro
virtual void CreateAndStartWorkers() override
virtual G4bool InitializeSeeds(G4int) override
InitializeSeedsCallback initSeedsCallback
static G4TemplateRNGHelper< T > * GetInstance()
Definition: G4RNGHelper.cc:42
void Fill(G4double *dbl, G4int nev, G4int nev_tot, G4int nrpe)
Definition: G4RNGHelper.hh:83
void Start()

◆ InitializeSeeds()

virtual G4bool G4TaskRunManager::InitializeSeeds ( G4int  )
inlineoverrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 155 of file G4TaskRunManager.hh.

155{ return false; }

Referenced by InitializeEventLoop().

◆ InitializeThreadPool()

void G4TaskRunManager::InitializeThreadPool ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 259 of file G4TaskRunManager.cc.

260{
262 {
263 G4Exception("G4TaskRunManager::InitializeThreadPool", "Run1040",
264 JustWarning, "Threadpool already initialized. Ignoring...");
265 return;
266 }
267
270
271 // create the joiners
272 if(!workTaskGroup)
274
275 if(verboseLevel > 0)
276 {
277 std::stringstream ss;
278 ss.fill('=');
279 ss << std::setw(90) << "";
280 G4cout << "\n" << ss.str() << G4endl;
281
283 {
284 G4cout << "G4TaskRunManager :: Using TBB..." << G4endl;
285 }
286 else
287 {
288 G4cout << "G4TaskRunManager :: Using G4ThreadPool..." << G4endl;
289 }
290
291 G4cout << ss.str() << "\n" << G4endl;
292 }
293}
G4TaskGroup< void > RunTaskGroup
int GetVerbose() const
void SetVerbose(int val)
bool is_tbb_threadpool() const
Definition: ThreadPool.hh:192

Referenced by Initialize().

◆ MergeRun()

void G4TaskRunManager::MergeRun ( const G4Run localRun)

Definition at line 643 of file G4TaskRunManager.cc.

644{
645 G4AutoLock l(&runMergerMutex);
646 if(currentRun)
647 currentRun->Merge(localRun);
648}
G4Run * currentRun
virtual void Merge(const G4Run *)
Definition: G4Run.cc:67

◆ MergeScores()

void G4TaskRunManager::MergeScores ( const G4ScoringManager localScoringManager)

Definition at line 634 of file G4TaskRunManager.cc.

635{
636 G4AutoLock l(&scorerMergerMutex);
637 if(masterScM)
638 masterScM->Merge(localScoringManager);
639}
void Merge(const G4ScoringManager *scMan)

◆ NewActionRequest()

virtual void G4TaskRunManager::NewActionRequest ( WorkerActionRequest  )
inlineoverrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 205 of file G4TaskRunManager.hh.

205{}

◆ ProcessOneEvent()

void G4TaskRunManager::ProcessOneEvent ( G4int  i_event)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 297 of file G4TaskRunManager.cc.

298{
299 // Nothing to do
300}

◆ RefillSeeds()

void G4TaskRunManager::RefillSeeds ( )
overrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 481 of file G4TaskRunManager.cc.

482{
484 G4int nFill = 0;
486 {
487 case 0:
489 break;
490 case 1:
491 nFill = numberOfTasks - nSeedsFilled;
492 break;
493 case 2:
494 default:
497 1;
498 }
499 // Generates up to nSeedsMax seed pairs only.
500 if(nFill > nSeedsMax)
501 nFill = nSeedsMax;
502 masterRNGEngine->flatArray(nSeedsPerEvent * nFill, randDbl);
503 helper->Refill(randDbl, nFill);
504 nSeedsFilled += nFill;
505}
void Refill(G4double *dbl, G4int nev)
Definition: G4RNGHelper.hh:96

Referenced by SetUpAnEvent(), and SetUpNEvents().

◆ RequestWorkersProcessCommandsStack()

void G4TaskRunManager::RequestWorkersProcessCommandsStack ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 773 of file G4TaskRunManager.cc.

774{
776
777 auto process_commands_stack = []() {
779 if(mrm)
780 {
781 auto cmds = mrm->GetCommandStack();
782 for(const auto& itr : cmds)
783 G4UImanager::GetUIpointer()->ApplyCommand(itr); // TLS instance
785 }
786 };
787
788 if(threadPool)
789 threadPool->execute_on_all_threads(process_commands_stack);
790}
virtual void ThisWorkerProcessCommandsStackDone()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:495

Referenced by TerminateWorkers().

◆ RunTermination()

void G4TaskRunManager::RunTermination ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 599 of file G4TaskRunManager.cc.

600{
601 // Wait for all worker threads to have finished the run
602 // i.e. wait for them to return from RunTermination()
603 // This guarantee that userrunaction for workers has been called
604
605 // Wait now for all threads to finish event-loop
607 // Now call base-class methof
610}
virtual void RunTermination()
virtual void TerminateEventLoop()
virtual void WaitForEndEventLoopWorkers() override

◆ SetGrainsize()

void G4TaskRunManager::SetGrainsize ( G4int  n)
inline

Definition at line 92 of file G4TaskRunManager.hh.

92{ eventGrainsize = n; }

◆ SetInitializeSeedsCallback()

void G4TaskRunManager::SetInitializeSeedsCallback ( InitializeSeedsCallback  f)
inline

Definition at line 209 of file G4TaskRunManager.hh.

210 {
212 }

◆ SetNumberOfThreads()

void G4TaskRunManager::SetNumberOfThreads ( G4int  n)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 208 of file G4TaskRunManager.cc.

209{
210 if(forcedNwokers > 0)
211 {
212 if(verboseLevel > 0)
213 {
215 msg << "\n### Number of threads is forced to " << forcedNwokers
216 << " by G4FORCENUMBEROFTHREADS environment variable. G4TaskRunManager::"
217 << __FUNCTION__ << "(" << n << ") ignored ###";
218 G4Exception("G4TaskRunManager::SetNumberOfThreads(G4int)", "Run0132",
219 JustWarning, msg);
220 }
222 }
223 else
224 {
225 nworkers = n;
227 {
228 if(verboseLevel > 0)
229 {
230 std::stringstream ss;
231 ss << "\n### Thread-pool already initialized. Resizing to " << nworkers
232 << "threads ###";
233 G4cout << ss.str() << "\n" << G4endl;
234 }
235 GetThreadPool()->resize(n);
236 }
237 }
238}
ThreadPool * GetThreadPool() const
void resize(size_type _n)
Definition: ThreadPool.hh:413

◆ SetUpAnEvent()

G4bool G4TaskRunManager::SetUpAnEvent ( G4Event evt,
G4long s1,
G4long s2,
G4long s3,
G4bool  reseedRequired = true 
)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 652 of file G4TaskRunManager.cc.

654{
655 G4AutoLock l(&setUpEventMutex);
657 {
659 if(reseedRequired)
660 {
662 G4int idx_rndm = nSeedsPerEvent * nSeedsUsed;
663 s1 = helper->GetSeed(idx_rndm);
664 s2 = helper->GetSeed(idx_rndm + 1);
665 if(nSeedsPerEvent == 3)
666 s3 = helper->GetSeed(idx_rndm + 2);
667 ++nSeedsUsed;
669 RefillSeeds();
670 }
672 return true;
673 }
674 return false;
675}
void SetEventID(G4int i)
Definition: G4Event.hh:80
virtual void RefillSeeds() override
virtual const T GetSeed(const G4int &sdId)
Definition: G4RNGHelper.hh:64

◆ SetUpNEvents()

G4int G4TaskRunManager::SetUpNEvents ( G4Event evt,
G4SeedsQueue seedsQueue,
G4bool  reseedRequired = true 
)
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 679 of file G4TaskRunManager.cc.

681{
682 G4AutoLock l(&setUpEventMutex);
684 {
685 G4int nevt = numberOfEventsPerTask;
686 G4int nmod = eventModulo;
688 {
691 }
693
694 if(reseedRequired)
695 {
697 G4int nevRnd = nmod;
699 nevRnd = 1;
700 for(G4int i = 0; i < nevRnd; ++i)
701 {
702 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed));
703 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed + 1));
704 if(nSeedsPerEvent == 3)
705 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed + 2));
706 nSeedsUsed++;
708 RefillSeeds();
709 }
710 }
712 return nevt;
713 }
714 return 0;
715}

◆ StoreRNGStatus()

void G4TaskRunManager::StoreRNGStatus ( const G4String filenamePrefix)
overrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 199 of file G4TaskRunManager.cc.

200{
201 std::ostringstream os;
202 os << randomNumberStatusDir << "G4Master_" << fn << ".rndm";
203 G4Random::saveEngineStatus(os.str().c_str());
204}
G4String randomNumberStatusDir

◆ TerminateOneEvent()

void G4TaskRunManager::TerminateOneEvent ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 304 of file G4TaskRunManager.cc.

305{
306 // Nothing to do
307}

◆ TerminateWorkers()

void G4TaskRunManager::TerminateWorkers ( )
overrideprotectedvirtual

Reimplemented from G4MTRunManager.

Definition at line 719 of file G4TaskRunManager.cc.

720{
721 // Force workers to execute (if any) all UI commands left in the stack
723
724 if(workTaskGroup)
725 {
727 if(!fakeRun)
730 }
731}
virtual void RequestWorkersProcessCommandsStack() override
Up join(Up accum={})
Definition: TaskGroup.hh:654

Referenced by ~G4TaskRunManager().

◆ ThisWorkerEndEventLoop()

virtual void G4TaskRunManager::ThisWorkerEndEventLoop ( )
inlineoverridevirtual

Reimplemented from G4MTRunManager.

Definition at line 198 of file G4TaskRunManager.hh.

198{}

◆ ThisWorkerProcessCommandsStackDone()

void G4TaskRunManager::ThisWorkerProcessCommandsStackDone ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 794 of file G4TaskRunManager.cc.

794{}

◆ ThisWorkerReady()

virtual void G4TaskRunManager::ThisWorkerReady ( )
inlineoverridevirtual

Reimplemented from G4MTRunManager.

Definition at line 197 of file G4TaskRunManager.hh.

197{}

◆ ThisWorkerWaitForNextAction()

virtual WorkerActionRequest G4TaskRunManager::ThisWorkerWaitForNextAction ( )
inlineoverridevirtual

Reimplemented from G4MTRunManager.

Definition at line 199 of file G4TaskRunManager.hh.

◆ ThreadPoolIsInitialized()

G4bool G4TaskRunManager::ThreadPoolIsInitialized ( ) const
inline

Definition at line 118 of file G4TaskRunManager.hh.

118{ return poolInitialized; }

◆ WaitForEndEventLoopWorkers()

void G4TaskRunManager::WaitForEndEventLoopWorkers ( )
overridevirtual

Reimplemented from G4MTRunManager.

Definition at line 760 of file G4TaskRunManager.cc.

Referenced by RunTermination().

◆ WaitForReadyWorkers()

virtual void G4TaskRunManager::WaitForReadyWorkers ( )
inlineoverridevirtual

Reimplemented from G4MTRunManager.

Definition at line 195 of file G4TaskRunManager.hh.

195{}

Friends And Related Function Documentation

◆ G4RunManagerFactory

friend class G4RunManagerFactory
friend

Definition at line 70 of file G4TaskRunManager.hh.

Member Data Documentation

◆ initSeedsCallback

InitializeSeedsCallback G4TaskRunManager::initSeedsCallback
protected
Initial value:
= [](G4int, G4int&, G4int&) {
return false;
}

Definition at line 238 of file G4TaskRunManager.hh.

Referenced by InitializeEventLoop(), and SetInitializeSeedsCallback().

◆ poolInitialized

G4bool& G4TaskRunManager::poolInitialized = PTL::TaskRunManager::m_is_initialized
protected

◆ taskManager

G4TaskManager*& G4TaskRunManager::taskManager = PTL::TaskRunManager::m_task_manager
protected

Definition at line 236 of file G4TaskRunManager.hh.

◆ taskQueue

G4VUserTaskQueue*& G4TaskRunManager::taskQueue = PTL::TaskRunManager::m_task_queue
protected

Definition at line 235 of file G4TaskRunManager.hh.

Referenced by G4TaskRunManager().

◆ threadPool

◆ workTaskGroup

RunTaskGroup* G4TaskRunManager::workTaskGroup = nullptr
protected

The documentation for this class was generated from the following files: