ATLAS Offline Software
MPIClusterSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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 
14 #include "SQLiteDBSvc/Statement.h"
15 #include "mpi3/environment.hpp"
16 
17 namespace mpi3 = boost::mpi3;
18 
23 class MPIClusterSvc : public extends<AthService, IMPIClusterSvc> {
24  public:
26  MPIClusterSvc(const std::string& name, ISvcLocator* svcLoc)
27  : extends(name, svcLoc) {}
28 
30  virtual StatusCode initialize() override final;
31 
33  virtual StatusCode finalize() override final;
34 
36  virtual int numRanks() const override final;
37 
39  virtual int rank() const override final;
40 
43  virtual void barrier() override final;
44 
46  virtual void abort() override final;
47 
49  virtual void sendMessage(
50  int destRank, ClusterMessage message,
51  ClusterComm communicator = ClusterComm::Default) override final;
52 
55  ClusterComm communicator = ClusterComm::Default) override final;
56 
58  virtual mpi3::communicator& data_communicator() override final {
59  return m_datacom;
60  }
61 
63  virtual void log_addEvent(int eventIdx, std::int64_t run_number,
64  std::int64_t event_number,
65  std::int64_t request_time_ns) override final;
67  virtual void log_completeEvent(std::int64_t run_number,
68  std::int64_t event_number,
69  std::int64_t status) override final;
70 
71  private:
72  std::unique_ptr<mpi3::environment> m_env;
73  mpi3::communicator m_world;
74  // Communicator for payload of event data messages
75  mpi3::communicator m_datacom;
76  int m_rank = -1;
77 
78  // MPI Log DB
79  ServiceHandle<ISQLiteDBSvc> m_mpiLog{this, "LogDatabaseSvc", "",
80  "SQLiteDBSvc for the MPI event log"};
83 };
84 #endif // ATHENASERVICES_MPICLUSTERSVC_H_
plotting.plot_kinematics.run_number
run_number
Definition: plot_kinematics.py:29
MPIClusterSvc::MPIClusterSvc
MPIClusterSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: MPIClusterSvc.h:26
SQLite::Statement
SQLite prepared statement.
Definition: Statement.h:50
Statement.h
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) override final
Add (begin) an event in the log.
Definition: MPIClusterSvc.cxx:157
MPIClusterSvc::numRanks
virtual int numRanks() const override final
Return number of ranks.
Definition: MPIClusterSvc.cxx:61
MPIClusterSvc
A service managing communications within a cluster using MPI.
Definition: MPIClusterSvc.h:23
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
MPIClusterSvc::sendMessage
virtual void sendMessage(int destRank, ClusterMessage message, ClusterComm communicator=ClusterComm::Default) override final
Send an MPI message.
Definition: MPIClusterSvc.cxx:78
ReweightUtils.message
message
Definition: ReweightUtils.py:15
MPIClusterSvc::data_communicator
virtual mpi3::communicator & data_communicator() override final
Return the data communicator.
Definition: MPIClusterSvc.h:58
MPIClusterSvc::abort
virtual void abort() override final
Abort the MPI run.
Definition: MPIClusterSvc.cxx:74
boost::mpi3
Definition: IMPIClusterSvc.h:14
MPIClusterSvc::finalize
virtual StatusCode finalize() override final
Finalize.
Definition: MPIClusterSvc.cxx:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MPIClusterSvc::m_mpiLog_addEvent
SQLite::Statement m_mpiLog_addEvent
Definition: MPIClusterSvc.h:81
MPIClusterSvc::initialize
virtual StatusCode initialize() override final
Initialize.
Definition: MPIClusterSvc.cxx:8
ISQLiteDBSvc.h
columnar::final
CM final
Definition: ColumnAccessor.h:106
ClusterMessage
A class describing a message sent between nodes in a cluster.
Definition: ClusterMessage.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MPIClusterSvc::waitReceiveMessage
virtual ClusterMessage waitReceiveMessage(ClusterComm communicator=ClusterComm::Default) override final
Block until we receive an MPI message.
Definition: MPIClusterSvc.cxx:120
ClusterComm
ClusterComm
Definition: IMPIClusterSvc.h:18
MPIClusterSvc::rank
virtual int rank() const override final
Return our rank.
Definition: MPIClusterSvc.cxx:65
MPIClusterSvc::m_mpiLog_completeEvent
SQLite::Statement m_mpiLog_completeEvent
Definition: MPIClusterSvc.h:82
MPIClusterSvc::m_mpiLog
ServiceHandle< ISQLiteDBSvc > m_mpiLog
Definition: MPIClusterSvc.h:79
MPIClusterSvc::m_datacom
mpi3::communicator m_datacom
Definition: MPIClusterSvc.h:75
MPIClusterSvc::log_completeEvent
virtual void log_completeEvent(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:164
AthService.h
MPIClusterSvc::m_rank
int m_rank
Definition: MPIClusterSvc.h:76
MPIClusterSvc::m_world
mpi3::communicator m_world
Definition: MPIClusterSvc.h:73
merge.status
status
Definition: merge.py:16
IMPIClusterSvc.h
Default
ClusterMessage.h
MPIClusterSvc::barrier
virtual void barrier() override final
Insert a barrier No rank will continue until all ranks reach this point.
Definition: MPIClusterSvc.cxx:69
ServiceHandle< ISQLiteDBSvc >
MPIClusterSvc::m_env
std::unique_ptr< mpi3::environment > m_env
Definition: MPIClusterSvc.h:72