18#ifndef MOTIV_READERCALLBACKS_HPP
19#define MOTIV_READERCALLBACKS_HPP
21#include <otf2xx/otf2.hpp>
24#include "src/models/Slot.hpp"
25#include "src/models/communication/Communication.hpp"
26#include "src/models/communication/NonBlockingSendEvent.hpp"
27#include "src/models/communication/NonBlockingReceiveEvent.hpp"
28#include "src/models/communication/CollectiveCommunicationEvent.hpp"
31using BuilderSetLocation = std::function<
typename T::Builder *(
typename T::Builder &,
32 otf2::definition::location &)>;
35using BuilderSetTime = std::function<
typename T::Builder *(
typename T::Builder &,
36 otf2::chrono::duration &)>;
39using BuilderSetter = std::function<void(
typename T::Builder &)>;
41typedef std::variant<NonBlockingSendEvent::Builder, NonBlockingReceiveEvent::Builder> NonBlockingCommunicationEventBuilder;
50 using otf2::reader::callback::event;
51 using otf2::reader::callback::definition;
53 std::vector<Slot *> slots_;
54 std::vector<Communication *> communications_;
55 std::vector<CollectiveCommunicationEvent *> collectiveCommunications_;
60 std::map<otf2::reference<otf2::definition::location>, std::vector<Slot::Builder> *> slotsBuilding;
65 std::map<uint32_t, std::vector<CommunicationEvent *> *> pendingSends;
70 std::map<uint32_t, std::vector<CommunicationEvent *> *> pendingReceives;
72 std::map<otf2::reference<otf2::definition::location>, CollectiveCommunicationEvent::Member::Builder> ongoingCollectiveCommunicationMembers;
73 CollectiveCommunicationEvent::Builder *ongoingCollectiveCommunication =
nullptr;
78 std::map<uint64_t, NonBlockingCommunicationEventBuilder> uncompletedRequests;
80 otf2::chrono::time_point program_start_;
81 otf2::chrono::time_point program_end_;
83 otf2::reader::reader &rdr_;
91 void definition(
const otf2::definition::location &loc)
override;
93 void event(
const otf2::definition::location &location,
const otf2::event::program_begin &event)
override;
95 void event(
const otf2::definition::location &location,
const otf2::event::program_end &event)
override;
97 void event(
const otf2::definition::location &location,
const otf2::event::enter &event)
override;
99 void event(
const otf2::definition::location &location,
const otf2::event::leave &event)
override;
101 void event(
const otf2::definition::location &location,
const otf2::event::mpi_send &send)
override;
103 void event(
const otf2::definition::location &location,
const otf2::event::mpi_receive &receive)
override;
105 void event(
const otf2::definition::location &location,
const otf2::event::mpi_isend_request &request)
override;
107 void event(
const otf2::definition::location &location,
const otf2::event::mpi_isend_complete &complete)
override;
109 void event(
const otf2::definition::location &location,
const otf2::event::mpi_ireceive_request &request)
override;
111 void event(
const otf2::definition::location &location,
const otf2::event::mpi_ireceive_complete &complete)
override;
113 void event(
const otf2::definition::location &location,
const otf2::event::mpi_request_test &test)
override;
116 event(
const otf2::definition::location &location,
const otf2::event::mpi_request_cancelled &cancelled)
override;
118 void event(
const otf2::definition::location &location,
const otf2::event::mpi_collective_begin &begin)
override;
120 void event(
const otf2::definition::location &location,
const otf2::event::mpi_collective_end &anEnd)
override;
122 void events_done(
const otf2::reader::reader &)
override;
157 [[nodiscard]] otf2::chrono::duration
duration()
const;
161 void communicationEvent(T *self, uint32_t matching,
162 std::map<uint32_t, std::vector<CommunicationEvent *> *> &selfPending,
163 std::map<uint32_t, std::vector<CommunicationEvent *> *> &matchingPending);
165 [[nodiscard]] otf2::chrono::duration relative(otf2::chrono::time_point)
const;
Class implementing handlers for the otf readers events.
std::vector< Slot * > getSlots()
Returns all read slots.
std::vector< Communication * > getCommunications()
Returns all read point to point communications.
otf2::chrono::duration duration() const
std::vector< CollectiveCommunicationEvent * > getCollectiveCommunications()
Returns all read collective communications.