Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
utils.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 "utils.hpp"
19
20void resetLayout(QLayout *apLayout) {
21 if(!apLayout) return;
22 QLayoutItem *vpItem;
23 while ((vpItem = apLayout->takeAt(0)) != 0) {
24 if (vpItem->layout()) {
25 resetLayout(vpItem->layout());
26 vpItem->layout()->deleteLater();
27 }
28 if (vpItem->widget()) {
29 vpItem->widget()->deleteLater();
30 }
31 delete vpItem;
32 }
33}
34
35
36std::string communicationKindName(CommunicationKind kind) {
37 switch (kind) {
38 case BlockingSend:
39 return "Blocking send";
40 case BlockingReceive:
41 return "Blocking receive";
42 case NonBlockingSend:
43 return "Non-blocking send";
44 case NonBlockingReceive:
45 return "Non-blocking receive";
46 case Collective:
47 return "Collective";
48 case RequestCancelled:
49 return "Request cancelled";
50 default:
51 throw std::invalid_argument("Invalid communication kind");
52 }
53}
54
55std::string collectiveCommunicationOperationName(otf2::collective_type type) {
56 switch (type) {
57 case otf2::common::collective_type::barrier:
58 return "Barrier";
59 case otf2::common::collective_type::broadcast:
60 return "Broadcast";
61 case otf2::common::collective_type::gather:
62 return "Gather";
63 case otf2::common::collective_type::gatherv:
64 return "Gatherv";
65 case otf2::common::collective_type::scatter:
66 return "Scatter";
67 case otf2::common::collective_type::scatterv:
68 return "Scatterv";
69 case otf2::common::collective_type::all_gather:
70 return "All Gather";
71 case otf2::common::collective_type::all_gatherv:
72 return "All Gatherv";
73 case otf2::common::collective_type::all_to_all:
74 return "All To All";
75 case otf2::common::collective_type::all_to_allv:
76 return "All To Allv";
77 case otf2::common::collective_type::all_to_allw:
78 return "All To Allw";
79 case otf2::common::collective_type::all_reduce:
80 return "All Reduce";
81 case otf2::common::collective_type::reduce:
82 return "Reduce";
83 case otf2::common::collective_type::reduce_scatter:
84 return "Reduce Scatter";
85 case otf2::common::collective_type::scan:
86 return "Scan";
87 case otf2::common::collective_type::exscan:
88 return "Exscan";
89 case otf2::common::collective_type::reduce_scatter_block:
90 return "Reduce Scatter Block";
91 case otf2::common::collective_type::create_handle:
92 return "Create Handle";
93 case otf2::common::collective_type::destroy_handle:
94 return "Destroy Handle";
95 case otf2::common::collective_type::allocate:
96 return "Allocate";
97 case otf2::common::collective_type::deallocate:
98 return "Deallocate";
99 case otf2::common::collective_type::create_handle_and_allocate:
100 return "Create Handle And Allocate";
101 case otf2::common::collective_type::destroy_handle_and_deallocate:
102 return "Destroy Handle And Deallocate";
103 default:
104 throw std::invalid_argument("Invalid operation type");
105 }
106}