Skip to content

Commit c5854ca

Browse files
authored
alignment changes (#62)
1 parent 9098b70 commit c5854ca

File tree

3 files changed

+45
-29
lines changed

3 files changed

+45
-29
lines changed

include/osp/bsp/model/BspArchitecture.hpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ inline std::ostream &operator<<(std::ostream &os, MEMORY_CONSTRAINT_TYPE type) {
112112
*/
113113
template<typename Graph_t>
114114
class BspArchitecture {
115-
116115
static_assert(is_computational_dag_v<Graph_t>, "BspSchedule can only be used with computational DAGs.");
117116

118117
private:
@@ -245,7 +244,6 @@ class BspArchitecture {
245244
communicationCosts_(other.communicationCosts()), synchronisationCosts_(other.synchronisationCosts()),
246245
memoryBound_(other.memoryBound()), isNuma_(other.isNumaArchitecture()), processorTypes_(other.processorTypes()),
247246
sendCosts_(other.sendCostsVector()) {
248-
249247
static_assert(std::is_same_v<v_memw_t<Graph_t>, v_memw_t<Graph_t_other>>,
250248
"BspArchitecture: Graph_t and Graph_t_other have the same memory weight type.");
251249

@@ -338,15 +336,13 @@ class BspArchitecture {
338336
}
339337

340338
for (unsigned j = 0U; j < numberOfProcessors_; j++) {
341-
if (i == j) {
342-
if (vec.at(i).at(j) != 0U)
343-
throw std::invalid_argument("Invalid Argument: Diagonal elements should be 0.");
344-
} else {
345-
sendCosts_.at(FlatIndex(i, j)) = vec.at(i).at(j);
339+
if (i == j && vec.at(i).at(j) != 0U) {
340+
throw std::invalid_argument("Invalid Argument: Diagonal elements should be 0.");
341+
}
346342

347-
if (numberOfProcessors_ > 1U && vec.at(i).at(j) != vec.at(0U).at(1U)) {
348-
isNuma_ = true;
349-
}
343+
sendCosts_.at(FlatIndex(i, j)) = vec.at(i).at(j);
344+
if (numberOfProcessors_ > 1U && vec.at(i).at(j) != vec.at(0U).at(1U)) {
345+
isNuma_ = true;
350346
}
351347
}
352348
}
@@ -589,7 +585,7 @@ class BspArchitecture {
589585

590586
/**
591587
* @brief Returns the send costs between two processors. Does not perform bounds checking.
592-
* Does not the communication costs into account.
588+
* Does not take the communication costs into account.
593589
*
594590
* @param p1 The index of the first processor.
595591
* @param p2 The index of the second processor.

include/osp/bsp/model/BspInstance.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class BspInstance {
185185

186186
/**
187187
* @brief Returns the send costs between two processors. Does not perform bounds checking.
188-
* Does not the communication costs into account.
188+
* Does not take the communication costs into account.
189189
*
190190
* @param p_send The index of the sending processor.
191191
* @param p_receive The index of the receiving processor.

include/osp/concepts/graph_traits.hpp

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,45 @@ limitations under the License.
3333
namespace osp {
3434

3535
/**
36-
* @brief Macro to define a trait that checks for the existence of a specific type member.
36+
* @brief Traits to check for the existence of specific type members.
3737
*
38-
* Creates a struct `test_name<T>` inheriting from `std::true_type` if `T::member_name` exists,
39-
* otherwise inherits from `std::false_type`.
38+
* These structs inherit from `std::true_type` if the specified member type exists in `T`,
39+
* otherwise they inherit from `std::false_type`.
4040
*/
41-
#define DEFINE_TYPE_MEMBER_TEST(test_name, member_name) \
42-
template<typename T, typename = void> \
43-
struct test_name : std::false_type {}; \
44-
template<typename T> \
45-
struct test_name<T, std::void_t<typename T::member_name>> : std::true_type {};
46-
47-
DEFINE_TYPE_MEMBER_TEST(has_vertex_idx_tmember, vertex_idx)
48-
DEFINE_TYPE_MEMBER_TEST(has_edge_desc_tmember, directed_edge_descriptor)
49-
DEFINE_TYPE_MEMBER_TEST(has_vertex_work_weight_tmember, vertex_work_weight_type)
50-
DEFINE_TYPE_MEMBER_TEST(has_vertex_comm_weight_tmember, vertex_comm_weight_type)
51-
DEFINE_TYPE_MEMBER_TEST(has_vertex_mem_weight_tmember, vertex_mem_weight_type)
52-
DEFINE_TYPE_MEMBER_TEST(has_vertex_type_tmember, vertex_type_type)
53-
DEFINE_TYPE_MEMBER_TEST(has_edge_comm_weight_tmember, edge_comm_weight_type)
41+
template<typename T, typename = void>
42+
struct has_vertex_idx_tmember : std::false_type {};
43+
template<typename T>
44+
struct has_vertex_idx_tmember<T, std::void_t<typename T::vertex_idx>> : std::true_type {};
45+
46+
template<typename T, typename = void>
47+
struct has_edge_desc_tmember : std::false_type {};
48+
template<typename T>
49+
struct has_edge_desc_tmember<T, std::void_t<typename T::directed_edge_descriptor>> : std::true_type {};
50+
51+
template<typename T, typename = void>
52+
struct has_vertex_work_weight_tmember : std::false_type {};
53+
template<typename T>
54+
struct has_vertex_work_weight_tmember<T, std::void_t<typename T::vertex_work_weight_type>> : std::true_type {};
55+
56+
template<typename T, typename = void>
57+
struct has_vertex_comm_weight_tmember : std::false_type {};
58+
template<typename T>
59+
struct has_vertex_comm_weight_tmember<T, std::void_t<typename T::vertex_comm_weight_type>> : std::true_type {};
60+
61+
template<typename T, typename = void>
62+
struct has_vertex_mem_weight_tmember : std::false_type {};
63+
template<typename T>
64+
struct has_vertex_mem_weight_tmember<T, std::void_t<typename T::vertex_mem_weight_type>> : std::true_type {};
65+
66+
template<typename T, typename = void>
67+
struct has_vertex_type_tmember : std::false_type {};
68+
template<typename T>
69+
struct has_vertex_type_tmember<T, std::void_t<typename T::vertex_type_type>> : std::true_type {};
70+
71+
template<typename T, typename = void>
72+
struct has_edge_comm_weight_tmember : std::false_type {};
73+
template<typename T>
74+
struct has_edge_comm_weight_tmember<T, std::void_t<typename T::edge_comm_weight_type>> : std::true_type {};
5475

5576
/**
5677
* @brief Core traits for any directed graph type.
@@ -81,7 +102,6 @@ using vertex_idx_t = typename directed_graph_traits<T>::vertex_idx;
81102
*/
82103
template<typename Graph_t>
83104
struct directed_edge {
84-
85105
vertex_idx_t<Graph_t> source;
86106
vertex_idx_t<Graph_t> target;
87107

0 commit comments

Comments
 (0)