ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaMPTools
src
SharedHiveEvtQueueConsumer.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_SHAREDHIVEEVTQUEUECONSUMER_H
6
#define ATHENAMPTOOLS_SHAREDHIVEEVTQUEUECONSUMER_H
7
8
#include "
AthenaMPToolBase.h
"
9
10
#include "
AthenaInterprocess/SharedQueue.h
"
11
#include "GaudiKernel/IScheduler.h"
12
#include "GaudiKernel/IEvtSelector.h"
13
14
#include <memory>
15
#include <queue>
16
17
18
class
IDataShare
;
19
class
IEvtSelectorSeek
;
20
class
IChronoStatSvc;
21
22
class
SharedHiveEvtQueueConsumer
final :
public
AthenaMPToolBase
23
{
24
public
:
25
SharedHiveEvtQueueConsumer
(
const
std::string&
type
26
,
const
std::string& name
27
,
const
IInterface* parent);
28
29
virtual
~SharedHiveEvtQueueConsumer
()
override
;
30
31
virtual
StatusCode
initialize
()
override
;
32
virtual
StatusCode
finalize
()
override
;
33
34
// _________IAthenaMPTool_________
35
virtual
int
makePool
ATLAS_NOT_THREAD_SAFE
(
int
maxevt,
int
nprocs,
const
std::string& topdir)
override
;
36
virtual
StatusCode exec
ATLAS_NOT_THREAD_SAFE
()
override
;
37
virtual
StatusCode wait_once
ATLAS_NOT_THREAD_SAFE
(
pid_t
& pid)
override
;
38
39
virtual
void
reportSubprocessStatuses
()
override
;
40
virtual
void
subProcessLogs
(std::vector<std::string>&)
override
;
41
42
// _____ Actual working horses ________
43
virtual
std::unique_ptr<AthenaInterprocess::ScheduledWork>
bootstrap_func
()
override
;
44
virtual
std::unique_ptr<AthenaInterprocess::ScheduledWork>
exec_func
()
override
;
45
virtual
std::unique_ptr<AthenaInterprocess::ScheduledWork>
fin_func
()
override
;
46
47
private
:
48
49
StatusCode
initHive
();
50
51
// Decode process results
52
// 1. Store number of processed events for FUNC_EXEC
53
// 2. If doFinalize flag is set then serialize process finalizations
54
int
decodeProcessResult
ATLAS_NOT_THREAD_SAFE
(
const
AthenaInterprocess::ProcessResult
* presult,
bool
doFinalize);
55
56
// Properties
57
Gaudi::Property<int>
m_nEventsBeforeFork
{
58
this
,
"EventsBeforeFork"
, 0,
59
"The number of events before forking the workers. The default is 0."
};
60
61
Gaudi::Property<bool>
m_debug
{
62
this
,
"Debug"
,
false
,
63
"Perform extra debugging if true. The default is false."
};
64
65
Gaudi::Property<bool>
m_useSharedWriter
{
66
this
,
"UseSharedWriter"
,
false
,
67
"Use SharedWriter to merge worker outputs on-the-fly if true. The default is false."
};
68
69
70
int
m_rankId
{-1};
// Each worker has its own unique RankID from the range (0,...,m_nprocs-1)
71
72
ServiceHandle<IChronoStatSvc>
m_chronoStatSvc
;
73
SmartIF<IDataShare>
m_dataShare
;
74
SmartIF<IEvtSelectorSeek>
m_evtSelSeek
;
75
IEvtSelector::Context*
m_evtContext
{};
76
77
AthenaInterprocess::SharedQueue
*
m_sharedEventQueue
{};
78
std::unique_ptr<AthenaInterprocess::SharedQueue>
m_sharedRankQueue
;
79
80
std::map<pid_t,int>
m_nProcessedEvents
;
// Number of processed events by PID
81
std::queue<pid_t>
m_finQueue
;
// PIDs of processes queued for finalization
82
83
SmartIF<IScheduler>
m_schedulerSvc
;
84
85
};
86
87
#endif
AthenaMPToolBase.h
pid_t
int32_t pid_t
Definition
FPGATrackSimTypes.h:19
SharedQueue.h
AthenaInterprocess::SharedQueue
Definition
SharedQueue.h:21
AthenaMPToolBase::AthenaMPToolBase
AthenaMPToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition
AthenaMPToolBase.cxx:33
IDataShare
Abstract interface for sharing data.
Definition
IDataShare.h:24
IEvtSelectorSeek
Abstract interface for seeking for an event selector.
Definition
IEvtSelectorSeek.h:28
ServiceHandle
Definition
ClusterMakerTool.h:36
SharedHiveEvtQueueConsumer::reportSubprocessStatuses
virtual void reportSubprocessStatuses() override
Definition
SharedHiveEvtQueueConsumer.cxx:189
SharedHiveEvtQueueConsumer::m_debug
Gaudi::Property< bool > m_debug
Definition
SharedHiveEvtQueueConsumer.h:61
SharedHiveEvtQueueConsumer::m_nEventsBeforeFork
Gaudi::Property< int > m_nEventsBeforeFork
Definition
SharedHiveEvtQueueConsumer.h:57
SharedHiveEvtQueueConsumer::ATLAS_NOT_THREAD_SAFE
virtual StatusCode exec ATLAS_NOT_THREAD_SAFE() override
SharedHiveEvtQueueConsumer::initialize
virtual StatusCode initialize() override
Definition
SharedHiveEvtQueueConsumer.cxx:59
SharedHiveEvtQueueConsumer::m_chronoStatSvc
ServiceHandle< IChronoStatSvc > m_chronoStatSvc
Definition
SharedHiveEvtQueueConsumer.h:72
SharedHiveEvtQueueConsumer::fin_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > fin_func() override
Definition
SharedHiveEvtQueueConsumer.cxx:515
SharedHiveEvtQueueConsumer::ATLAS_NOT_THREAD_SAFE
virtual StatusCode wait_once ATLAS_NOT_THREAD_SAFE(pid_t &pid) override
SharedHiveEvtQueueConsumer::subProcessLogs
virtual void subProcessLogs(std::vector< std::string > &) override
Definition
SharedHiveEvtQueueConsumer.cxx:209
SharedHiveEvtQueueConsumer::m_sharedEventQueue
AthenaInterprocess::SharedQueue * m_sharedEventQueue
Definition
SharedHiveEvtQueueConsumer.h:77
SharedHiveEvtQueueConsumer::m_useSharedWriter
Gaudi::Property< bool > m_useSharedWriter
Definition
SharedHiveEvtQueueConsumer.h:65
SharedHiveEvtQueueConsumer::m_evtSelSeek
SmartIF< IEvtSelectorSeek > m_evtSelSeek
Definition
SharedHiveEvtQueueConsumer.h:74
SharedHiveEvtQueueConsumer::m_rankId
int m_rankId
Definition
SharedHiveEvtQueueConsumer.h:70
SharedHiveEvtQueueConsumer::m_dataShare
SmartIF< IDataShare > m_dataShare
Definition
SharedHiveEvtQueueConsumer.h:73
SharedHiveEvtQueueConsumer::exec_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > exec_func() override
Definition
SharedHiveEvtQueueConsumer.cxx:346
SharedHiveEvtQueueConsumer::m_nProcessedEvents
std::map< pid_t, int > m_nProcessedEvents
Definition
SharedHiveEvtQueueConsumer.h:80
SharedHiveEvtQueueConsumer::m_sharedRankQueue
std::unique_ptr< AthenaInterprocess::SharedQueue > m_sharedRankQueue
Definition
SharedHiveEvtQueueConsumer.h:78
SharedHiveEvtQueueConsumer::bootstrap_func
virtual std::unique_ptr< AthenaInterprocess::ScheduledWork > bootstrap_func() override
Definition
SharedHiveEvtQueueConsumer.cxx:224
SharedHiveEvtQueueConsumer::~SharedHiveEvtQueueConsumer
virtual ~SharedHiveEvtQueueConsumer() override
Definition
SharedHiveEvtQueueConsumer.cxx:53
SharedHiveEvtQueueConsumer::m_finQueue
std::queue< pid_t > m_finQueue
Definition
SharedHiveEvtQueueConsumer.h:81
SharedHiveEvtQueueConsumer::m_evtContext
IEvtSelector::Context * m_evtContext
Definition
SharedHiveEvtQueueConsumer.h:75
SharedHiveEvtQueueConsumer::ATLAS_NOT_THREAD_SAFE
int decodeProcessResult ATLAS_NOT_THREAD_SAFE(const AthenaInterprocess::ProcessResult *presult, bool doFinalize)
SharedHiveEvtQueueConsumer::finalize
virtual StatusCode finalize() override
Definition
SharedHiveEvtQueueConsumer.cxx:85
SharedHiveEvtQueueConsumer::m_schedulerSvc
SmartIF< IScheduler > m_schedulerSvc
Definition
SharedHiveEvtQueueConsumer.h:83
SharedHiveEvtQueueConsumer::initHive
StatusCode initHive()
Definition
SharedHiveEvtQueueConsumer.cxx:614
SharedHiveEvtQueueConsumer::ATLAS_NOT_THREAD_SAFE
virtual int makePool ATLAS_NOT_THREAD_SAFE(int maxevt, int nprocs, const std::string &topdir) override
SharedHiveEvtQueueConsumer::SharedHiveEvtQueueConsumer
SharedHiveEvtQueueConsumer(const std::string &type, const std::string &name, const IInterface *parent)
Definition
SharedHiveEvtQueueConsumer.cxx:42
AthenaInterprocess::ProcessResult
Definition
ProcessGroup.h:22
type
Generated on
for ATLAS Offline Software by
1.17.0