ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaServices
src
MPIClusterSvc.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef ATHENASERVICES_MPICLUSTERSVC_H_
5
#define ATHENASERVICES_MPICLUSTERSVC_H_
6
7
#include <memory>
8
#include <string>
9
10
#include "
AthenaBaseComps/AthService.h
"
11
#include "
AthenaKernel/ClusterMessage.h
"
12
#include "
AthenaKernel/IMPIClusterSvc.h
"
13
#include "GaudiKernel/IIncidentListener.h"
14
#include "
SQLiteDBSvc/ISQLiteDBSvc.h
"
15
#include "
SQLiteDBSvc/Statement.h
"
16
#include "mpi3/environment.hpp"
17
18
namespace
mpi3
=
boost::mpi3
;
19
24
class
MPIClusterSvc
25
:
public
extends<AthService, IMPIClusterSvc, IIncidentListener> {
26
public
:
28
MPIClusterSvc
(
const
std::string& name, ISvcLocator* svcLoc)
29
: extends(name, svcLoc) {}
30
32
virtual
StatusCode
initialize
() override final;
33
35
virtual StatusCode
finalize
() override final;
36
38
virtual
void
handle
(
const
Incident& inc) override;
39
41
virtual
int
numRanks
()
const
override final;
42
44
virtual
int
rank
()
const
override final;
45
48
virtual
void
barrier
() override final;
49
51
virtual
void
abort
() override final;
52
54
virtual
void
sendMessage
(
55
int
destRank,
ClusterMessage
message,
56
ClusterComm
communicator =
ClusterComm
::
Default
) override final;
57
59
virtual
ClusterMessage
waitReceiveMessage
(
60
ClusterComm
communicator =
ClusterComm
::
Default
) override final;
61
63
virtual
mpi3
::communicator&
data_communicator
() override final {
64
return
m_datacom
;
65
}
66
68
virtual
void
log_addEvent
(
int
eventIdx, std::int64_t run_number,
69
std::int64_t event_number,
70
std::int64_t request_time_ns,
71
std::size_t slot)
override
final
;
73
virtual
void
log_completeEvent
(
int
eventIdx, std::int64_t run_number,
74
std::int64_t event_number,
75
std::int64_t status)
override
final
;
76
77
private
:
78
std::unique_ptr<mpi3::environment>
m_env
;
79
mpi3::communicator
m_world
;
80
// Communicator for payload of event data messages
81
mpi3::communicator
m_datacom
;
82
int
m_rank
= -1;
83
84
// MPI Log DB
85
ServiceHandle<ISQLiteDBSvc>
m_mpiLog
{
this
,
"LogDatabaseSvc"
,
""
,
86
"SQLiteDBSvc for the MPI event log"
};
87
SQLite::Statement
m_mpiLog_addEvent
;
88
SQLite::Statement
m_mpiLog_completeEvent
;
89
SQLite::Statement
m_mpiLog_addFile
;
90
91
// Hold current input filename hash for each slot
92
std::int64_t
m_lastInputFileHash
{};
93
std::map<std::size_t, std::int64_t>
m_inputFileSlotMap
{};
94
};
95
#endif
// ATHENASERVICES_MPICLUSTERSVC_H_
AthService.h
ClusterMessage.h
IMPIClusterSvc.h
ClusterComm
ClusterComm
Definition
IMPIClusterSvc.h:18
ClusterComm::Default
@ Default
Definition
IMPIClusterSvc.h:18
ISQLiteDBSvc.h
Statement.h
MPIClusterSvc::m_lastInputFileHash
std::int64_t m_lastInputFileHash
Definition
MPIClusterSvc.h:92
MPIClusterSvc::waitReceiveMessage
virtual ClusterMessage waitReceiveMessage(ClusterComm communicator=ClusterComm::Default) override final
Block until we receive an MPI message.
Definition
MPIClusterSvc.cxx:188
MPIClusterSvc::barrier
virtual void barrier() override final
Insert a barrier No rank will continue until all ranks reach this point.
Definition
MPIClusterSvc.cxx:137
MPIClusterSvc::data_communicator
virtual mpi3::communicator & data_communicator() override final
Return the data communicator.
Definition
MPIClusterSvc.h:63
MPIClusterSvc::log_addEvent
virtual void log_addEvent(int eventIdx, std::int64_t run_number, std::int64_t event_number, std::int64_t request_time_ns, std::size_t slot) override final
Add (begin) an event in the log.
Definition
MPIClusterSvc.cxx:237
MPIClusterSvc::m_rank
int m_rank
Definition
MPIClusterSvc.h:82
MPIClusterSvc::m_mpiLog_addFile
SQLite::Statement m_mpiLog_addFile
Definition
MPIClusterSvc.h:89
MPIClusterSvc::m_env
std::unique_ptr< mpi3::environment > m_env
Definition
MPIClusterSvc.h:78
MPIClusterSvc::m_mpiLog_addEvent
SQLite::Statement m_mpiLog_addEvent
Definition
MPIClusterSvc.h:87
MPIClusterSvc::handle
virtual void handle(const Incident &inc) override
IIncidentListener handle.
Definition
MPIClusterSvc.cxx:106
MPIClusterSvc::abort
virtual void abort() override final
Abort the MPI run.
Definition
MPIClusterSvc.cxx:142
MPIClusterSvc::rank
virtual int rank() const override final
Return our rank.
Definition
MPIClusterSvc.cxx:133
MPIClusterSvc::MPIClusterSvc
MPIClusterSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition
MPIClusterSvc.h:28
MPIClusterSvc::m_world
mpi3::communicator m_world
Definition
MPIClusterSvc.h:79
MPIClusterSvc::initialize
virtual StatusCode initialize() override final
Initialize.
Definition
MPIClusterSvc.cxx:13
MPIClusterSvc::m_datacom
mpi3::communicator m_datacom
Definition
MPIClusterSvc.h:81
MPIClusterSvc::finalize
virtual StatusCode finalize() override final
Finalize.
Definition
MPIClusterSvc.cxx:97
MPIClusterSvc::log_completeEvent
virtual void log_completeEvent(int eventIdx, std::int64_t run_number, std::int64_t event_number, std::int64_t status) override final
Complete an event in the log.
Definition
MPIClusterSvc.cxx:245
MPIClusterSvc::m_mpiLog_completeEvent
SQLite::Statement m_mpiLog_completeEvent
Definition
MPIClusterSvc.h:88
MPIClusterSvc::sendMessage
virtual void sendMessage(int destRank, ClusterMessage message, ClusterComm communicator=ClusterComm::Default) override final
Send an MPI message.
Definition
MPIClusterSvc.cxx:146
MPIClusterSvc::m_mpiLog
ServiceHandle< ISQLiteDBSvc > m_mpiLog
Definition
MPIClusterSvc.h:85
MPIClusterSvc::numRanks
virtual int numRanks() const override final
Return number of ranks.
Definition
MPIClusterSvc.cxx:129
MPIClusterSvc::m_inputFileSlotMap
std::map< std::size_t, std::int64_t > m_inputFileSlotMap
Definition
MPIClusterSvc.h:93
SQLite::Statement
SQLite prepared statement.
Definition
Statement.h:50
ServiceHandle
Definition
ClusterMakerTool.h:36
const
boost::mpi3
Definition
IMPIClusterSvc.h:14
ClusterMessage
A class describing a message sent between nodes in a cluster.
Definition
ClusterMessage.h:31
Generated on
for ATLAS Offline Software by
1.17.0