1+ /*
2+ Copyright 2024 Huawei Technologies Co., Ltd.
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+
16+ @author Toni Boehnlein, Benjamin Lozes, Pal Andras Papp, Raphael S. Steiner
17+ */
18+ #pragma once
19+
20+ namespace osp {
21+
22+ /* *
23+ * @brief Implementation of a computational DAG vertex.
24+ *
25+ * This struct holds the properties of a vertex in a computational DAG, including its ID,
26+ * weights (work, communication, memory), and type.
27+ *
28+ * @tparam vertex_idx_t Type for vertex indices.
29+ * @tparam workw_t Type for work weights.
30+ * @tparam commw_t Type for communication weights.
31+ * @tparam memw_t Type for memory weights.
32+ * @tparam vertex_type_t Type for vertex types.
33+ */
34+ template <typename vertex_idx_t , typename workw_t , typename commw_t , typename memw_t , typename vertex_type_t >
35+ struct cdag_vertex_impl {
36+
37+ using vertex_idx_type = vertex_idx_t ;
38+ using work_weight_type = workw_t ;
39+ using comm_weight_type = commw_t ;
40+ using mem_weight_type = memw_t ;
41+ using cdag_vertex_type_type = vertex_type_t ;
42+
43+ cdag_vertex_impl () = default ;
44+
45+ cdag_vertex_impl (const cdag_vertex_impl &other) = default ;
46+ cdag_vertex_impl (cdag_vertex_impl &&other) noexcept = default ;
47+ cdag_vertex_impl &operator =(const cdag_vertex_impl &other) = default ;
48+ cdag_vertex_impl &operator =(cdag_vertex_impl &&other) noexcept = default ;
49+
50+ /* *
51+ * @brief Constructs a vertex with specified properties.
52+ *
53+ * @param vertex_idx_ The unique identifier for the vertex.
54+ * @param work_w The computational work weight.
55+ * @param comm_w The communication weight.
56+ * @param mem_w The memory weight.
57+ * @param vertex_t The type of the vertex.
58+ */
59+ cdag_vertex_impl (vertex_idx_t vertex_idx_, workw_t work_w, commw_t comm_w, memw_t mem_w,
60+ vertex_type_t vertex_t )
61+ : id(vertex_idx_), work_weight(work_w), comm_weight(comm_w), mem_weight(mem_w),
62+ vertex_type (vertex_t ) {}
63+
64+ vertex_idx_t id = 0 ;
65+
66+ workw_t work_weight = 0 ;
67+ commw_t comm_weight = 0 ;
68+ memw_t mem_weight = 0 ;
69+
70+ vertex_type_t vertex_type = 0 ;
71+ };
72+
73+ /* *
74+ * @brief A vertex implementation with integer weights. Indexed by size_t. Node types are unsigned.
75+ *
76+ * This struct implements a vertex with integer weights for work, communication, and memory.
77+ */
78+ using cdag_vertex_impl_int = cdag_vertex_impl<size_t , int , int , int , unsigned >;
79+
80+ /* *
81+ * @brief A vertex implementation with unsigned weights. Indexed by size_t. Node types are unsigned.
82+ *
83+ * This struct implements a vertex with unsigned weights for work, communication, and memory.
84+ */
85+ using cdag_vertex_impl_unsigned = cdag_vertex_impl<size_t , unsigned , unsigned , unsigned , unsigned >;
86+
87+ } // namespace osp
0 commit comments