Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
InformationDockCollectiveCommunicationStrategy.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 "InformationDockCollectiveCommunicationStrategy.hpp"
19#include "src/utils.hpp"
20
21
23 communicatorField = new QLabel;
24 operationField = new QLabel;
25 rootField = new QLabel;
26
27 layout->addRow(tr("Communicator:"), communicatorField);
28 layout->addRow(tr("Operation:"), operationField);
29 layout->addRow(tr("Root:"), rootField);
30
32}
33
35 auto communicator = std::get<otf2::definition::comm>(*element->getCommunicator());
36
37 auto collectiveRoot = static_cast<otf2::collective_root_type>(element->getRoot());
38
39 QString rootName = "Unknown";
40 switch(collectiveRoot) {
41 case otf2::common::collective_root_type::none:
42 rootName = "None";
43 break;
44 case otf2::common::collective_root_type::self:
45 rootName = "Self";
46 break;
47 case otf2::common::collective_root_type::this_group:
48 rootName = "This Group";
49 break;
50 default:
51 if(holds_alternative<otf2::definition::comm_group>(communicator.group())) {
52 auto group = get<otf2::definition::comm_group>(communicator.group());
53 auto root = group[element->getRoot()];
54
55 rootName = QString::fromStdString(root.name().str());
56 }
57 break;
58 }
59
60 auto operationName = QString::fromStdString(collectiveCommunicationOperationName(element->getOperation()));
61 auto communicatorName = QString::fromStdString(communicator.name().str());
62
63 rootField->setText(rootName);
64 operationField->setText(operationName);
65 communicatorField->setText(communicatorName);
66
68}
69
71 return tr("Collective communication").toStdString();
72}
A class representing an MPI collective operation.
types::communicator * getCommunicator() const override
otf2::collective_type getOperation() const
Returns the kind of the collective operation.
uint32_t getRoot() const
Returns the root of the collective operation.
void setup(QFormLayout *layout) override
Sets up the QFormLayout.
std::string title() override
Returns the title the information dock should show.
void updateView(QFormLayout *layout, CollectiveCommunicationEvent *element) override
Updates the view.
virtual void updateView(QFormLayout *layout, T *element)
Updates the view.
static QString tr(const char *s, const char *c=nullptr, int n=-1)
void setup(QFormLayout *layout) override
Sets up the QFormLayout.