ATLAS Offline Software
Loading...
Searching...
No Matches
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
13#include "GaudiKernel/IIncidentListener.h"
16#include "mpi3/environment.hpp"
17
18namespace mpi3 = boost::mpi3;
19
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
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"};
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_
ClusterComm
std::int64_t m_lastInputFileHash
virtual ClusterMessage waitReceiveMessage(ClusterComm communicator=ClusterComm::Default) override final
Block until we receive an MPI message.
virtual void barrier() override final
Insert a barrier No rank will continue until all ranks reach this point.
virtual mpi3::communicator & data_communicator() override final
Return the data communicator.
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.
SQLite::Statement m_mpiLog_addFile
std::unique_ptr< mpi3::environment > m_env
SQLite::Statement m_mpiLog_addEvent
virtual void handle(const Incident &inc) override
IIncidentListener handle.
virtual void abort() override final
Abort the MPI run.
virtual int rank() const override final
Return our rank.
MPIClusterSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
mpi3::communicator m_world
virtual StatusCode initialize() override final
Initialize.
mpi3::communicator m_datacom
virtual StatusCode finalize() override final
Finalize.
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.
SQLite::Statement m_mpiLog_completeEvent
virtual void sendMessage(int destRank, ClusterMessage message, ClusterComm communicator=ClusterComm::Default) override final
Send an MPI message.
ServiceHandle< ISQLiteDBSvc > m_mpiLog
virtual int numRanks() const override final
Return number of ranks.
std::map< std::size_t, std::int64_t > m_inputFileSlotMap
SQLite prepared statement.
Definition Statement.h:50
A class describing a message sent between nodes in a cluster.