Skip to content

Commit ce25be1

Browse files
committed
split dag_vector_adapter and cast_view
move constructor, operator added cdag_vertex_impl.hpp dag vector const const, at at
1 parent 7d97b8c commit ce25be1

8 files changed

Lines changed: 496 additions & 183 deletions

File tree

include/osp/auxiliary/io/DotFileWriter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ class DotFileWriter {
463463
}
464464

465465
write_graph_structure(
466-
os, g2, VertexWriterDuplicateRecompSchedule_DOT<Graph_t>(g2, names, node_to_proc, node_to_superstep));
466+
os, g2, VertexWriterDuplicateRecompSchedule_DOT<graph_t>(g2, names, node_to_proc, node_to_superstep));
467467
}
468468

469469
template<typename Graph_t>

include/osp/graph_algorithms/computational_dag_construction_util.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ template<typename Graph_from, typename Graph_to>
3030
bool construct_computational_dag(const Graph_from &from, Graph_to &to) {
3131

3232
static_assert(is_computational_dag_v<Graph_from>, "Graph_from must satisfy the computational_dag concept");
33-
static_assert(is_constructable_cdag_vertex_v<Graph_to>,
34-
"Graph_to must satisfy the constructable_cdag_vertex concept");
33+
static_assert(is_constructable_cdag_vertex_v<Graph_to>, "Graph_to must satisfy the constructable_cdag_vertex concept");
3534

3635
for (const auto &v_idx : from.vertices()) {
3736

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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

include/osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ limitations under the License.
1818
#pragma once
1919

2020
#include "osp/auxiliary/hash_util.hpp"
21-
#include "computational_dag_vector_impl.hpp"
21+
#include "cdag_vertex_impl.hpp"
2222
#include "edge_iterator.hpp"
23+
#include "osp/graph_implementations/integral_range.hpp"
2324
#include "osp/graph_algorithms/computational_dag_construction_util.hpp"
2425
#include <vector>
2526

0 commit comments

Comments
 (0)