Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
CollectiveCommunicationEvent.cpp
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#include "CollectiveCommunicationEvent.hpp"
19
20#include <utility>
21
23 otf2::definition::location *location,
24 types::communicator *communicator,
25 otf2::collective_type operation, uint32_t root) :
26 location(location), members(std::move(members)), communicator(communicator), operation(operation),
27 root(root) {
28 auto starting = std::min_element(this->members.begin(), this->members.end(), [](const Member* lhs, const Member* rhs) {return lhs->start < rhs->start;});
29 auto ending = std::max_element(this->members.begin(), this->members.end(), [](const Member* lhs, const Member* rhs) {return lhs->end < rhs->end;});
30
31 this->start = (*starting)->start;
32 this->end = (*ending)->end;
33}
34
35otf2::definition::location * CollectiveCommunicationEvent::getLocation() const {
36 return location;
37}
38
39otf2::chrono::duration CollectiveCommunicationEvent::getStartTime() const {
40 return start;
41}
42
43otf2::chrono::duration CollectiveCommunicationEvent::getEndTime() const {
44 return end;
45}
46
47types::communicator * CollectiveCommunicationEvent::getCommunicator() const {
48 return communicator;
49}
50
51CommunicationKind CollectiveCommunicationEvent::getKind() const {
52 return Collective;
53}
54
55otf2::collective_type CollectiveCommunicationEvent::getOperation() const {
56 return operation;
57}
58
60 return root;
61}
62
63const std::vector<CollectiveCommunicationEvent::Member *> &CollectiveCommunicationEvent::getMembers() const {
64 return members;
65}
66
A class representing a member of a 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
CollectiveCommunicationEvent(std::vector< Member * > members, otf2::definition::location *location, types::communicator *communicator, otf2::collective_type operation, uint32_t root)
Creates a new instance of the CollectiveCommunicationEvent class.
otf2::chrono::duration getEndTime() const override
Returns the end time of the collective operations.