ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaMPToolBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHENAMPTOOLS_ATHENAMPTOOLBASE_H
6#define ATHENAMPTOOLS_ATHENAMPTOOLBASE_H
7
10#include "GaudiKernel/IEventProcessor.h"
11#include "GaudiKernel/IAppMgrUI.h"
12#include "GaudiKernel/IFileMgr.h"
13#include "GaudiKernel/IIoComponentMgr.h"
14
18
19#include <filesystem>
20
21class IEvtSelector;
22
23class AthenaMPToolBase : public extends<AthAlgTool, IAthenaMPTool>,
25{
26 public:
27 AthenaMPToolBase(const std::string& type
28 , const std::string& name
29 , const IInterface* parent);
30
31 virtual ~AthenaMPToolBase() override;
32
33 virtual StatusCode initialize() override;
34 virtual StatusCode finalize() override;
35
36 // _________IAthenaMPTool_________
37 virtual StatusCode wait_once ATLAS_NOT_THREAD_SAFE (pid_t& pid) override;
38
39 virtual void reportSubprocessStatuses() override;
41
42 virtual void useFdsRegistry(std::shared_ptr<AthenaInterprocess::FdsRegistry>) override;
43 virtual void setRandString(const std::string& randStr) override;
44 virtual void setMaxEvt(int maxEvt) override {m_maxEvt=maxEvt;}
45 virtual void setMPRunStop(const AthenaInterprocess::IMPRunStop* runStop) override {m_mpRunStop=runStop;}
46
47 virtual void killChildren() override;
48
49 // _________IMessageDecoder_________
50 virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> operator() ATLAS_NOT_THREAD_SAFE (const AthenaInterprocess::ScheduledWork&) override;
51
52 // _____ Actual working horses ________
53 virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> bootstrap_func() = 0;
54 virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> exec_func() = 0;
55 virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> fin_func() = 0;
56
66
72
73 int mapAsyncFlag ATLAS_NOT_THREAD_SAFE(Func_Flag flag, pid_t pid=0);
74 int redirectLog(const std::string& rundir, bool addTimeStamp = true);
75 int updateIoReg(const std::string& rundir);
76 std::string fmterror(int errnum);
77
78 int reopenFds();
79 int handleSavedPfc(const std::filesystem::path& dest_path);
80
81 void waitForSignal();
82
83 IEvtSelector* evtSelector() { return m_evtSelector; }
84
85 int m_nprocs{-1};
86 int m_maxEvt{-1};
87 std::string m_subprocTopDir;
88 std::string m_subprocDirPrefix;
89 std::string m_evtSelName;
90
93
98 SmartIF<IEvtSelector> m_evtSelector;
99 std::string m_fileMgrLog;
100 std::shared_ptr<AthenaInterprocess::FdsRegistry> m_fdsRegistry;
101 std::string m_randStr;
102
103 Gaudi::Property<bool> m_isPileup {this, "IsPileup", false, "Flag for configuring PileUpEventLoopMgr"};
104
105 private:
109 int reopenFd(int fd, const std::string& name); // reopen individual descriptor
110
111};
112
113#endif
int32_t pid_t
#define protected
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
virtual std::unique_ptr< ScheduledWork > operator() ATLAS_NOT_THREAD_SAFE(const ScheduledWork &)=0
virtual void killChildren() override
AthenaMPToolBase(const AthenaMPToolBase &)
virtual void setMPRunStop(const AthenaInterprocess::IMPRunStop *runStop) override
AthenaMPToolBase & operator=(const AthenaMPToolBase &)
virtual StatusCode wait_once ATLAS_NOT_THREAD_SAFE(pid_t &pid) override
virtual ~AthenaMPToolBase() override
std::string m_subprocTopDir
Top run directory for subprocesses.
virtual void useFdsRegistry(std::shared_ptr< AthenaInterprocess::FdsRegistry >) override
int handleSavedPfc(const std::filesystem::path &dest_path)
int updateIoReg(const std::string &rundir)
std::string m_evtSelName
Name of the event selector.
SmartIF< IEvtSelector > m_evtSelector
AthenaMPToolBase(const std::string &type, const std::string &name, const IInterface *parent)
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > exec_func()=0
int m_maxEvt
Maximum number of events assigned to the job.
IEvtSelector * evtSelector()
virtual StatusCode initialize() override
Gaudi::Property< bool > m_isPileup
int redirectLog(const std::string &rundir, bool addTimeStamp=true)
std::string m_fileMgrLog
ServiceHandle< IAppMgrUI > m_appMgr
int m_nprocs
Number of workers spawned by the master process.
const AthenaInterprocess::IMPRunStop * m_mpRunStop
ServiceHandle< IIoComponentMgr > m_ioMgr
virtual AthenaMP::AllWorkerOutputs_ptr generateOutputReport() override
int mapAsyncFlag ATLAS_NOT_THREAD_SAFE(Func_Flag flag, pid_t pid=0)
virtual void reportSubprocessStatuses() override
int reopenFd(int fd, const std::string &name)
AthenaInterprocess::ProcessGroup * m_processGroup
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > virtual operator()ATLAS_NOT_THREAD_SAFE(const AthenaInterprocess std::unique_ptr< AthenaInterprocess::ScheduledWork > bootstrap_func()=0
std::shared_ptr< AthenaInterprocess::FdsRegistry > m_fdsRegistry
ServiceHandle< IEventProcessor > m_evtProcessor
ServiceHandle< IFileMgr > m_fileMgr
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > fin_func()=0
virtual void setMaxEvt(int maxEvt) override
std::string m_subprocDirPrefix
For ex. "worker__".
virtual StatusCode finalize() override
virtual void setRandString(const std::string &randStr) override
std::string fmterror(int errnum)
STL class.
std::unique_ptr< AllWorkerOutputs > AllWorkerOutputs_ptr
STL namespace.