Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions include/osp/bsp/model/BspArchitecture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ inline std::ostream &operator<<(std::ostream &os, MEMORY_CONSTRAINT_TYPE type) {
*/
template<typename Graph_t>
class BspArchitecture {

static_assert(is_computational_dag_v<Graph_t>, "BspSchedule can only be used with computational DAGs.");

private:
Expand Down Expand Up @@ -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<Graph_t>, v_memw_t<Graph_t_other>>,
"BspArchitecture: Graph_t and Graph_t_other have the same memory weight type.");

Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/osp/bsp/model/BspInstance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
54 changes: 37 additions & 17 deletions include/osp/concepts/graph_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` 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<typename T, typename = void> \
struct test_name : std::false_type {}; \
template<typename T> \
struct test_name<T, std::void_t<typename T::member_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<typename T, typename = void>
struct has_vertex_idx_tmember : std::false_type {};
template<typename T>
struct has_vertex_idx_tmember<T, std::void_t<typename T::vertex_idx>> : std::true_type {};

template<typename T, typename = void>
struct has_edge_desc_tmember : std::false_type {};
template<typename T>
struct has_edge_desc_tmember<T, std::void_t<typename T::directed_edge_descriptor>> : std::true_type {};

template<typename T, typename = void>
struct has_vertex_work_weight_tmember : std::false_type {};
template<typename T>
struct has_vertex_work_weight_tmember<T, std::void_t<typename T::vertex_work_weight_type>> : std::true_type {};

template<typename T, typename = void>
struct has_vertex_comm_weight_tmember : std::false_type {};
template<typename T>
struct has_vertex_comm_weight_tmember<T, std::void_t<typename T::vertex_comm_weight_type>> : std::true_type {};

template<typename T, typename = void>
struct has_vertex_mem_weight_tmember : std::false_type {};
template<typename T>
struct has_vertex_mem_weight_tmember<T, std::void_t<typename T::vertex_mem_weight_type>> : std::true_type {};

template<typename T, typename = void>
struct has_vertex_type_tmember : std::false_type {};
template<typename T>
struct has_vertex_type_tmember<T, std::void_t<typename T::vertex_type_type>> : std::true_type {};

template<typename T, typename = void>
struct has_edge_comm_weight_tmember : std::false_type {};
template<typename T>
struct has_edge_comm_weight_tmember<T, std::void_t<typename T::edge_comm_weight_type>> : std::true_type {};

/**
* @brief Core traits for any directed graph type.
Expand Down Expand Up @@ -81,7 +102,6 @@ using vertex_idx_t = typename directed_graph_traits<T>::vertex_idx;
*/
template<typename Graph_t>
struct directed_edge {

vertex_idx_t<Graph_t> source;
vertex_idx_t<Graph_t> target;

Expand Down