diff --git a/include/osp/bsp/model/BspArchitecture.hpp b/include/osp/bsp/model/BspArchitecture.hpp index 5575fad2..52240fa2 100644 --- a/include/osp/bsp/model/BspArchitecture.hpp +++ b/include/osp/bsp/model/BspArchitecture.hpp @@ -112,7 +112,6 @@ inline std::ostream &operator<<(std::ostream &os, MEMORY_CONSTRAINT_TYPE type) { */ template class BspArchitecture { - static_assert(is_computational_dag_v, "BspSchedule can only be used with computational DAGs."); private: @@ -245,7 +244,6 @@ class BspArchitecture { communicationCosts_(other.communicationCosts()), synchronisationCosts_(other.synchronisationCosts()), memoryBound_(other.memoryBound()), isNuma_(other.isNumaArchitecture()), processorTypes_(other.processorTypes()), sendCosts_(other.sendCostsVector()) { - static_assert(std::is_same_v, v_memw_t>, "BspArchitecture: Graph_t and Graph_t_other have the same memory weight type."); @@ -338,15 +336,13 @@ class BspArchitecture { } for (unsigned j = 0U; j < numberOfProcessors_; j++) { - if (i == j) { - if (vec.at(i).at(j) != 0U) - throw std::invalid_argument("Invalid Argument: Diagonal elements should be 0."); - } else { - sendCosts_.at(FlatIndex(i, j)) = vec.at(i).at(j); + if (i == j && vec.at(i).at(j) != 0U) { + throw std::invalid_argument("Invalid Argument: Diagonal elements should be 0."); + } - if (numberOfProcessors_ > 1U && vec.at(i).at(j) != vec.at(0U).at(1U)) { - isNuma_ = true; - } + sendCosts_.at(FlatIndex(i, j)) = vec.at(i).at(j); + if (numberOfProcessors_ > 1U && vec.at(i).at(j) != vec.at(0U).at(1U)) { + isNuma_ = true; } } } @@ -589,7 +585,7 @@ class BspArchitecture { /** * @brief Returns the send costs between two processors. Does not perform bounds checking. - * Does not the communication costs into account. + * Does not take the communication costs into account. * * @param p1 The index of the first processor. * @param p2 The index of the second processor. diff --git a/include/osp/bsp/model/BspInstance.hpp b/include/osp/bsp/model/BspInstance.hpp index bed4fd40..72f16e1e 100644 --- a/include/osp/bsp/model/BspInstance.hpp +++ b/include/osp/bsp/model/BspInstance.hpp @@ -185,7 +185,7 @@ class BspInstance { /** * @brief Returns the send costs between two processors. Does not perform bounds checking. - * Does not the communication costs into account. + * Does not take the communication costs into account. * * @param p_send The index of the sending processor. * @param p_receive The index of the receiving processor. diff --git a/include/osp/concepts/graph_traits.hpp b/include/osp/concepts/graph_traits.hpp index 357ca1c9..48e980ac 100644 --- a/include/osp/concepts/graph_traits.hpp +++ b/include/osp/concepts/graph_traits.hpp @@ -33,24 +33,45 @@ limitations under the License. namespace osp { /** - * @brief Macro to define a trait that checks for the existence of a specific type member. + * @brief Traits to check for the existence of specific type members. * - * Creates a struct `test_name` inheriting from `std::true_type` if `T::member_name` exists, - * otherwise inherits from `std::false_type`. + * These structs inherit from `std::true_type` if the specified member type exists in `T`, + * otherwise they inherit from `std::false_type`. */ -#define DEFINE_TYPE_MEMBER_TEST(test_name, member_name) \ - template \ - struct test_name : std::false_type {}; \ - template \ - struct test_name> : std::true_type {}; - -DEFINE_TYPE_MEMBER_TEST(has_vertex_idx_tmember, vertex_idx) -DEFINE_TYPE_MEMBER_TEST(has_edge_desc_tmember, directed_edge_descriptor) -DEFINE_TYPE_MEMBER_TEST(has_vertex_work_weight_tmember, vertex_work_weight_type) -DEFINE_TYPE_MEMBER_TEST(has_vertex_comm_weight_tmember, vertex_comm_weight_type) -DEFINE_TYPE_MEMBER_TEST(has_vertex_mem_weight_tmember, vertex_mem_weight_type) -DEFINE_TYPE_MEMBER_TEST(has_vertex_type_tmember, vertex_type_type) -DEFINE_TYPE_MEMBER_TEST(has_edge_comm_weight_tmember, edge_comm_weight_type) +template +struct has_vertex_idx_tmember : std::false_type {}; +template +struct has_vertex_idx_tmember> : std::true_type {}; + +template +struct has_edge_desc_tmember : std::false_type {}; +template +struct has_edge_desc_tmember> : std::true_type {}; + +template +struct has_vertex_work_weight_tmember : std::false_type {}; +template +struct has_vertex_work_weight_tmember> : std::true_type {}; + +template +struct has_vertex_comm_weight_tmember : std::false_type {}; +template +struct has_vertex_comm_weight_tmember> : std::true_type {}; + +template +struct has_vertex_mem_weight_tmember : std::false_type {}; +template +struct has_vertex_mem_weight_tmember> : std::true_type {}; + +template +struct has_vertex_type_tmember : std::false_type {}; +template +struct has_vertex_type_tmember> : std::true_type {}; + +template +struct has_edge_comm_weight_tmember : std::false_type {}; +template +struct has_edge_comm_weight_tmember> : std::true_type {}; /** * @brief Core traits for any directed graph type. @@ -81,7 +102,6 @@ using vertex_idx_t = typename directed_graph_traits::vertex_idx; */ template struct directed_edge { - vertex_idx_t source; vertex_idx_t target;