Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
CollectiveCommunicationEvent.hpp
1/*
2 * Marvelous OTF2 Traces Interactive Visualizer (MOTIV)
3 * Copyright (C) 2023 Florian Gallrein, Björn Gehrke
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef MOTIV_COLLECTIVECOMMUNICATIONEVENT_HPP
20#define MOTIV_COLLECTIVECOMMUNICATIONEVENT_HPP
21
22
23#include "CommunicationEvent.hpp"
24
25#include <utility>
26
34public:
40 class Member {
41 public:
48 Member(const otf2::chrono::duration &start,
49 const otf2::chrono::duration &anEnd,
50 otf2::definition::location *location) :
51 start(start), end(anEnd), location(location) {}
52
53 public:
54 const otf2::chrono::duration start;
55 const otf2::chrono::duration end;
56 const otf2::definition::location* location;
58 public:
64 [[nodiscard]] const otf2::chrono::duration &getStart() const {
65 return start;
66 }
67
73 [[nodiscard]] const otf2::chrono::duration &getEnd() const {
74 return end;
75 }
76
82 [[nodiscard]] const otf2::definition::location * getLocation() const {
83 return location;
84 }
85
86 BUILDER(Member,
87 BUILDER_FIELD(otf2::chrono::duration, start)
88 BUILDER_FIELD(otf2::chrono::duration, end)
89 BUILDER_FIELD(otf2::definition::location*, location),
91 };
92
93public:
103 CollectiveCommunicationEvent(std::vector<Member *> members,
104 otf2::definition::location *location,
105 types::communicator *communicator,
106 otf2::collective_type operation,
107 uint32_t root);
108 ~CollectiveCommunicationEvent() override = default;
109
114 [[nodiscard]] otf2::definition::location * getLocation() const override;
115
124 [[nodiscard]] otf2::chrono::duration getStartTime() const override;
125
132 [[nodiscard]] otf2::chrono::duration getEndTime() const override;
133
137 [[nodiscard]] types::communicator * getCommunicator() const override;
138
143 [[nodiscard]] CommunicationKind getKind() const override;
144
149 [[nodiscard]] otf2::collective_type getOperation() const;
150
157 [[nodiscard]] uint32_t getRoot() const;
158
163 [[nodiscard]] const std::vector<Member *> &getMembers() const;
164
166 BUILDER_FIELD(std::vector<Member*>, members)
167 BUILDER_FIELD(otf2::definition::location*, location)
168 BUILDER_FIELD(types::communicator*, communicator)
169 BUILDER_FIELD(otf2::collective_type, operation)
170 BUILDER_FIELD(uint32_t, root),
171 members, location, communicator, operation, root)
172
173private:
174 otf2::chrono::duration start{};
175 otf2::chrono::duration end{};
176 otf2::definition::location* location;
177 std::vector<Member*> members;
178 types::communicator* communicator;
179 otf2::common::collective_type operation;
180 std::uint32_t root;
181};
182
183
184#endif //MOTIV_COLLECTIVECOMMUNICATIONEVENT_HPP
A class representing a member of a collective operation.
const otf2::definition::location * location
const otf2::chrono::duration & getEnd() const
Returns the end time of the communication.
const otf2::definition::location * getLocation() const
Returns the location of the member.
Member(const otf2::chrono::duration &start, const otf2::chrono::duration &anEnd, otf2::definition::location *location)
Constructs a new instance of the Member class.
const otf2::chrono::duration & getStart() const
Returns the start time of the communication.
A class representing an MPI collective operation.
types::communicator * getCommunicator() const override
otf2::definition::location * getLocation() const override
Returns the location of the longest waiting member.
otf2::collective_type getOperation() const
Returns the kind of the collective operation.
uint32_t getRoot() const
Returns the root of the collective operation.
const std::vector< Member * > & getMembers() const
Returns all members participating in the collective operation.
otf2::chrono::duration getStartTime() const override
CommunicationKind getKind() const override
otf2::chrono::duration getEndTime() const override
Returns the end time of the collective operations.
Abstract class for generic Communication events.