35#ifndef G4TaskRunManager_hh
36#define G4TaskRunManager_hh 1
87 G4bool useTBB = G4GetEnv<G4bool>(
"G4USE_TBB",
false),
88 G4int evtGrainsize = 0);
97 return numberOfEventsPerTask;
115 const char* macroFile =
nullptr,
116 G4int n_select = -1)
override;
138 G4bool reseedRequired =
true)
override;
146 G4bool reseedRequired =
true)
override;
220 bool workersStarted =
false;
221 G4int eventGrainsize = 0;
222 G4int numberOfEventsPerTask = -1;
223 G4int numberOfTasks = -1;
std::queue< G4long > G4SeedsQueue
static G4MTRunManager * GetMasterRunManager()
virtual void ConstructScoringWorlds() override
virtual void InitializeThreadPool() override
virtual void CreateAndStartWorkers() override
static G4TaskRunManager * GetMasterRunManager()
virtual G4bool InitializeSeeds(G4int) override
virtual void ThisWorkerProcessCommandsStackDone() override
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true) override
G4TaskManager *& taskManager
G4VUserTaskQueue *& taskQueue
virtual void SetNumberOfThreads(G4int n) override
void SetInitializeSeedsCallback(InitializeSeedsCallback f)
std::function< G4bool(G4int, G4int &, G4int &)> InitializeSeedsCallback
G4int GetNumberOfEventsPerTask() const
virtual void AbortRun(G4bool softAbort=false) override
InitializeSeedsCallback initSeedsCallback
virtual void RefillSeeds() override
virtual void RequestWorkersProcessCommandsStack() override
G4int GetNumberOfTasks() const
virtual void AddEventTask(G4int)
static G4ThreadId GetMasterThreadId()
G4int GetGrainsize() const
virtual void Initialize(uint64_t nthreads) override
virtual void TerminateOneEvent() override
RunTaskGroup * workTaskGroup
virtual void TerminateWorkers() override
virtual void AbortEvent() override
virtual size_t GetNumberActiveThreads() const override
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1) override
virtual ~G4TaskRunManager()
virtual WorkerActionRequest ThisWorkerWaitForNextAction() override
void SetGrainsize(G4int n)
virtual void NewActionRequest(WorkerActionRequest) override
virtual void ThisWorkerEndEventLoop() override
virtual void Initialize() override
virtual void StoreRNGStatus(const G4String &filenamePrefix) override
virtual G4int GetNumberOfThreads() const override
virtual void RunTermination() override
void MergeScores(const G4ScoringManager *localScoringManager)
virtual void WaitForReadyWorkers() override
virtual void WaitForEndEventLoopWorkers() override
G4ThreadPool *& threadPool
static G4TaskRunManagerKernel * GetMTMasterRunManagerKernel()
G4bool ThreadPoolIsInitialized() const
virtual void ProcessOneEvent(G4int i_event) override
void MergeRun(const G4Run *localRun)
virtual void ComputeNumberOfTasks()
virtual G4bool SetUpAnEvent(G4Event *, G4long &s1, G4long &s2, G4long &s3, G4bool reseedRequired=true) override
virtual void ThisWorkerReady() override
virtual int GetNumberOfThreads() const
TaskManager * m_task_manager
virtual void Initialize(uint64_t n=std::thread::hardware_concurrency())
ThreadPool * m_thread_pool
VUserTaskQueue * m_task_queue
virtual size_t GetNumberActiveThreads() const