Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AthenaMPToolBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
21 class IEvtSelector;
22 
24  , public IAthenaMPTool
26 {
27  public:
28  AthenaMPToolBase(const std::string& type
29  , const std::string& name
30  , const IInterface* parent);
31 
32  virtual ~AthenaMPToolBase() override;
33 
34  virtual StatusCode initialize() override;
35  virtual StatusCode finalize() override;
36 
37  // _________IAthenaMPTool_________
38  virtual StatusCode wait_once ATLAS_NOT_THREAD_SAFE (pid_t& pid) override;
39 
40  virtual void reportSubprocessStatuses() override;
42 
43  virtual void useFdsRegistry(std::shared_ptr<AthenaInterprocess::FdsRegistry>) override;
44  virtual void setRandString(const std::string& randStr) override;
45  virtual void setMaxEvt(int maxEvt) override {m_maxEvt=maxEvt;}
46  virtual void setMPRunStop(const AthenaInterprocess::IMPRunStop* runStop) override {m_mpRunStop=runStop;}
47 
48  virtual void killChildren() override;
49 
50  // _________IMessageDecoder_________
51  virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> operator() ATLAS_NOT_THREAD_SAFE (const AthenaInterprocess::ScheduledWork&) override;
52 
53  // _____ Actual working horses ________
54  virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> bootstrap_func() = 0;
55  virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> exec_func() = 0;
56  virtual std::unique_ptr<AthenaInterprocess::ScheduledWork> fin_func() = 0;
57 
58  protected:
66  };
67 
68  enum Func_Flag {
72  };
73 
75  int redirectLog(const std::string& rundir, bool addTimeStamp = true);
76  int updateIoReg(const std::string& rundir);
77  std::string fmterror(int errnum);
78 
79  int reopenFds();
80  int handleSavedPfc(const std::filesystem::path& dest_path);
81 
82  void waitForSignal();
83 
84  IEvtSelector* evtSelector() { return m_evtSelector; }
85 
86  int m_nprocs; // Number of workers spawned by the master process
87  int m_maxEvt; // Maximum number of events assigned to the job
88  std::string m_subprocTopDir; // Top run directory for subprocesses
89  std::string m_subprocDirPrefix; // For ex. "worker__"
90  std::string m_evtSelName; // Name of the event selector
91 
94 
99  SmartIF<IEvtSelector> m_evtSelector;
100  std::string m_fileMgrLog;
101  std::shared_ptr<AthenaInterprocess::FdsRegistry> m_fdsRegistry;
102  std::string m_randStr;
103 
104  Gaudi::Property<bool> m_isPileup {this, "IsPileup", false, "Flag for configuring PileUpEventLoopMgr"};
105 
106  private:
110  int reopenFd(int fd, const std::string& name); // reopen individual descriptor
111 
112 };
113 
114 #endif
AthenaMPToolBase::killChildren
virtual void killChildren() override
Definition: AthenaMPToolBase.cxx:214
python.DQPostProcessMod.rundir
def rundir(fname)
Definition: DQPostProcessMod.py:116
pid_t
int32_t pid_t
Definition: FPGATrackSimTypes.h:19
AthenaInterprocess
Definition: FdsRegistry.h:11
AthenaMPToolBase::waitForSignal
void waitForSignal()
Definition: AthenaMPToolBase.cxx:429
IMessageDecoder.h
AthenaMPToolBase::fin_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > fin_func()=0
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
AthenaMPToolBase::ESRANGE_BADINPFILE
@ ESRANGE_BADINPFILE
Definition: AthenaMPToolBase.h:65
AthenaMPToolBase::m_processGroup
AthenaInterprocess::ProcessGroup * m_processGroup
Definition: AthenaMPToolBase.h:92
AthenaMPToolBase::~AthenaMPToolBase
virtual ~AthenaMPToolBase() override
Definition: AthenaMPToolBase.cxx:52
AthenaMPToolBase::exec_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > exec_func()=0
AthenaMPToolBase::m_randStr
std::string m_randStr
Definition: AthenaMPToolBase.h:102
AthenaMPToolBase::m_nprocs
int m_nprocs
Definition: AthenaMPToolBase.h:86
AthenaMPToolBase::ESRange_Status
ESRange_Status
Definition: AthenaMPToolBase.h:59
AthenaMPToolBase::FUNC_FIN
@ FUNC_FIN
Definition: AthenaMPToolBase.h:71
AthenaMPToolBase::setRandString
virtual void setRandString(const std::string &randStr) override
Definition: AthenaMPToolBase.cxx:209
AthenaMPToolBase
Definition: AthenaMPToolBase.h:26
AthenaMPToolBase::fmterror
std::string fmterror(int errnum)
Definition: AthenaMPToolBase.cxx:359
AthenaMPToolBase::ATLAS_NOT_THREAD_SAFE
int mapAsyncFlag ATLAS_NOT_THREAD_SAFE(Func_Flag flag, pid_t pid=0)
AthenaMPToolBase::generateOutputReport
virtual AthenaMP::AllWorkerOutputs_ptr generateOutputReport() override
Definition: AthenaMPToolBase.cxx:132
AthenaMPToolBase::m_evtSelName
std::string m_evtSelName
Definition: AthenaMPToolBase.h:90
AthenaMPToolBase::finalize
virtual StatusCode finalize() override
Definition: AthenaMPToolBase.cxx:100
ProcessGroup.h
AthenaMPToolBase::ESRANGE_SEEKFAILED
@ ESRANGE_SEEKFAILED
Definition: AthenaMPToolBase.h:62
AthenaMPToolBase::setMaxEvt
virtual void setMaxEvt(int maxEvt) override
Definition: AthenaMPToolBase.h:45
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
AthenaMPToolBase::m_fileMgrLog
std::string m_fileMgrLog
Definition: AthenaMPToolBase.h:100
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
AthenaMPToolBase::FUNC_EXEC
@ FUNC_EXEC
Definition: AthenaMPToolBase.h:70
AthenaInterprocess::IMessageDecoder::operator
virtual std::unique_ptr< ScheduledWork > operator() ATLAS_NOT_THREAD_SAFE(const ScheduledWork &)=0
AthenaMPToolBase::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Definition: AthenaMPToolBase.h:99
AthenaMPToolBase::m_appMgr
ServiceHandle< IAppMgrUI > m_appMgr
Definition: AthenaMPToolBase.h:96
AthenaMPToolBase::m_isPileup
Gaudi::Property< bool > m_isPileup
Definition: AthenaMPToolBase.h:104
AthenaMPToolBase::AthenaMPToolBase
AthenaMPToolBase(const AthenaMPToolBase &)
AthenaMPToolBase::bootstrap_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > virtual operator() ATLAS_NOT_THREAD_SAFE(const AthenaInterprocess std::unique_ptr< AthenaInterprocess::ScheduledWork > bootstrap_func()=0
AthenaMPToolBase::setMPRunStop
virtual void setMPRunStop(const AthenaInterprocess::IMPRunStop *runStop) override
Definition: AthenaMPToolBase.h:46
AthenaMPToolBase::Func_Flag
Func_Flag
Definition: AthenaMPToolBase.h:68
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaInterprocess::ProcessGroup
Definition: ProcessGroup.h:27
AthenaMPToolBase::useFdsRegistry
virtual void useFdsRegistry(std::shared_ptr< AthenaInterprocess::FdsRegistry >) override
Definition: AthenaMPToolBase.cxx:204
master.flag
bool flag
Definition: master.py:29
AthAlgTool.h
AthenaMPToolBase::reopenFd
int reopenFd(int fd, const std::string &name)
Definition: AthenaMPToolBase.cxx:445
AthenaMPToolBase::AthenaMPToolBase
AthenaMPToolBase()
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
AthenaMPToolBase::evtSelector
IEvtSelector * evtSelector()
Definition: AthenaMPToolBase.h:84
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaMPToolBase::ESRANGE_SUCCESS
@ ESRANGE_SUCCESS
Definition: AthenaMPToolBase.h:60
IAthenaMPTool
Definition: IAthenaMPTool.h:38
AthenaMPToolBase::updateIoReg
int updateIoReg(const std::string &rundir)
Definition: AthenaMPToolBase.cxx:338
AthenaMPToolBase::initialize
virtual StatusCode initialize() override
Definition: AthenaMPToolBase.cxx:56
AthenaMPToolBase::m_mpRunStop
const AthenaInterprocess::IMPRunStop * m_mpRunStop
Definition: AthenaMPToolBase.h:93
ReadFromCoolCompare.fd
fd
Definition: ReadFromCoolCompare.py:196
AthenaInterprocess::IMessageDecoder
Definition: IMessageDecoder.h:18
AthenaMPToolBase::ESRANGE_PROCFAILED
@ ESRANGE_PROCFAILED
Definition: AthenaMPToolBase.h:63
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthenaMPToolBase::m_ioMgr
ServiceHandle< IIoComponentMgr > m_ioMgr
Definition: AthenaMPToolBase.h:98
AthenaMPToolBase::redirectLog
int redirectLog(const std::string &rundir, bool addTimeStamp=true)
Definition: AthenaMPToolBase.cxx:282
AthenaMPToolBase::m_maxEvt
int m_maxEvt
Definition: AthenaMPToolBase.h:87
IAthenaMPTool.h
AthenaMP::AllWorkerOutputs_ptr
std::unique_ptr< AllWorkerOutputs > AllWorkerOutputs_ptr
Definition: IAthenaMPTool.h:32
AthenaMPToolBase::reportSubprocessStatuses
virtual void reportSubprocessStatuses() override
Definition: AthenaMPToolBase.cxx:124
AthenaMPToolBase::ATLAS_NOT_THREAD_SAFE
virtual StatusCode wait_once ATLAS_NOT_THREAD_SAFE(pid_t &pid) override
AthenaMPToolBase::operator=
AthenaMPToolBase & operator=(const AthenaMPToolBase &)
AthenaMPToolBase::m_subprocDirPrefix
std::string m_subprocDirPrefix
Definition: AthenaMPToolBase.h:89
AthenaMPToolBase::m_subprocTopDir
std::string m_subprocTopDir
Definition: AthenaMPToolBase.h:88
AthAlgTool
Definition: AthAlgTool.h:26
IAthenaMPTool::ATLAS_NOT_THREAD_SAFE
virtual StatusCode exec ATLAS_NOT_THREAD_SAFE()=0
AthenaMPToolBase::ESRANGE_NOTFOUND
@ ESRANGE_NOTFOUND
Definition: AthenaMPToolBase.h:61
AthenaInterprocess::IMPRunStop
Definition: IMPRunStop.h:10
AthenaMPToolBase::handleSavedPfc
int handleSavedPfc(const std::filesystem::path &dest_path)
Definition: AthenaMPToolBase.cxx:422
AthenaMPToolBase::m_fileMgr
ServiceHandle< IFileMgr > m_fileMgr
Definition: AthenaMPToolBase.h:97
AthenaMPToolBase::FUNC_BOOTSTRAP
@ FUNC_BOOTSTRAP
Definition: AthenaMPToolBase.h:69
IMPRunStop.h
AthenaMPToolBase::reopenFds
int reopenFds()
Definition: AthenaMPToolBase.cxx:366
AthenaMPToolBase::ESRANGE_FILENOTMADE
@ ESRANGE_FILENOTMADE
Definition: AthenaMPToolBase.h:64
AthenaMPToolBase::m_fdsRegistry
std::shared_ptr< AthenaInterprocess::FdsRegistry > m_fdsRegistry
Definition: AthenaMPToolBase.h:101
ServiceHandle< IEventProcessor >
AthenaMPToolBase::m_evtProcessor
ServiceHandle< IEventProcessor > m_evtProcessor
Definition: AthenaMPToolBase.h:95