Skip to content

Commit ce37884

Browse files
committed
cosmetics
1 parent 5d30220 commit ce37884

2 files changed

Lines changed: 8 additions & 22 deletions

File tree

include/osp/bsp/model/BspSchedule.hpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
105105
: instance(&schedule.getInstance()), number_of_supersteps(schedule.numberOfSupersteps()),
106106
node_to_processor_assignment(schedule.getInstance().numberOfVertices()),
107107
node_to_superstep_assignment(schedule.getInstance().numberOfVertices()) {
108-
109108
for (const auto &v : schedule.getInstance().getComputationalDag().vertices()) {
110-
111109
node_to_processor_assignment[v] = schedule.assignedProcessor(v);
112110
node_to_superstep_assignment[v] = schedule.assignedSuperstep(v);
113111
}
@@ -572,11 +570,14 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
572570
*/
573571
virtual void shrinkByMergingSupersteps() {
574572
std::vector<bool> comm_phase_empty(number_of_supersteps, true);
575-
for (const auto &node : instance->vertices())
576-
for (const auto &child : instance->getComputationalDag().children(node))
577-
if (node_to_processor_assignment[node] != node_to_processor_assignment[child])
573+
for (const auto &node : instance->vertices()) {
574+
for (const auto &child : instance->getComputationalDag().children(node)) {
575+
if (node_to_processor_assignment[node] != node_to_processor_assignment[child]) {
578576
for (unsigned offset = 1; offset <= getStaleness(); ++offset)
579577
comm_phase_empty[node_to_superstep_assignment[child] - offset] = false;
578+
}
579+
}
580+
}
580581

581582
std::vector<unsigned> new_step_index(number_of_supersteps);
582583
unsigned current_index = 0;
@@ -585,9 +586,9 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
585586
if (!comm_phase_empty[step])
586587
current_index++;
587588
}
588-
for (const auto &node : instance->vertices())
589+
for (const auto &node : instance->vertices()) {
589590
node_to_superstep_assignment[node] = new_step_index[node_to_superstep_assignment[node]];
590-
591+
}
591592
setNumberOfSupersteps(current_index);
592593
}
593594

@@ -633,7 +634,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
633634
std::vector<v_memw_t<Graph_t>> current_proc_transient_memory(instance->numberOfProcessors(), 0);
634635

635636
for (const auto &node : instance->vertices()) {
636-
637637
const unsigned proc = node_to_processor_assignment[node];
638638
current_proc_persistent_memory[proc] += instance->getComputationalDag().vertex_mem_weight(node);
639639
current_proc_transient_memory[proc] = std::max(
@@ -659,7 +659,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
659659
std::vector<v_memw_t<Graph_t>> current_proc_memory(instance->numberOfProcessors(), 0);
660660

661661
for (const auto &node : instance->vertices()) {
662-
663662
const unsigned proc = node_to_processor_assignment[node];
664663
current_proc_memory[proc] += instance->getComputationalDag().vertex_mem_weight(node);
665664

@@ -671,12 +670,10 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
671670
}
672671

673672
bool satisfiesLocalInOutMemoryConstraints() const {
674-
675673
SetSchedule set_schedule = SetSchedule(*this);
676674

677675
for (unsigned step = 0; step < number_of_supersteps; step++) {
678676
for (unsigned proc = 0; proc < instance->numberOfProcessors(); proc++) {
679-
680677
v_memw_t<Graph_t> memory = 0;
681678
for (const auto &node : set_schedule.step_processor_vertices[step][proc]) {
682679
memory += instance->getComputationalDag().vertex_mem_weight(node) +
@@ -701,20 +698,17 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
701698
}
702699

703700
bool satisfiesLocalIncEdgesMemoryConstraints() const {
704-
705701
SetSchedule set_schedule = SetSchedule(*this);
706702

707703
for (unsigned step = 0; step < number_of_supersteps; step++) {
708704
for (unsigned proc = 0; proc < instance->numberOfProcessors(); proc++) {
709-
710705
std::unordered_set<vertex_idx_t<Graph_t>> nodes_with_incoming_edges;
711706

712707
v_memw_t<Graph_t> memory = 0;
713708
for (const auto &node : set_schedule.step_processor_vertices[step][proc]) {
714709
memory += instance->getComputationalDag().vertex_comm_weight(node);
715710

716711
for (const auto &parent : instance->getComputationalDag().parents(node)) {
717-
718712
if (node_to_superstep_assignment[parent] != step) {
719713
nodes_with_incoming_edges.insert(parent);
720714
}
@@ -734,17 +728,14 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
734728
}
735729

736730
bool satisfiesLocalSourcesIncEdgesMemoryConstraints() const {
737-
738731
SetSchedule set_schedule = SetSchedule(*this);
739732

740733
for (unsigned step = 0; step < number_of_supersteps; step++) {
741734
for (unsigned proc = 0; proc < instance->numberOfProcessors(); proc++) {
742-
743735
std::unordered_set<vertex_idx_t<Graph_t>> nodes_with_incoming_edges;
744736

745737
v_memw_t<Graph_t> memory = 0;
746738
for (const auto &node : set_schedule.step_processor_vertices[step][proc]) {
747-
748739
if (is_source(node, instance->getComputationalDag())) {
749740
memory += instance->getComputationalDag().vertex_mem_weight(node);
750741
}

include/osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class computational_dag_vector_impl {
7878
explicit computational_dag_vector_impl(const vertex_idx num_vertices)
7979
: vertices_(num_vertices), out_neigbors(num_vertices), in_neigbors(num_vertices), num_edges_(0),
8080
num_vertex_types_(0) {
81-
8281
for (vertex_idx i = 0; i < num_vertices; ++i) {
8382
vertices_[i].id = i;
8483
}
@@ -98,9 +97,7 @@ class computational_dag_vector_impl {
9897
*/
9998
template<typename Graph_t>
10099
explicit computational_dag_vector_impl(const Graph_t &other) {
101-
102100
static_assert(is_computational_dag_v<Graph_t>, "Graph_t must satisfy the is_computation_dag concept");
103-
104101
constructComputationalDag(other, *this);
105102
}
106103

@@ -196,7 +193,6 @@ class computational_dag_vector_impl {
196193
*/
197194
vertex_idx add_vertex(const vertex_work_weight_type work_weight, const vertex_comm_weight_type comm_weight,
198195
const vertex_mem_weight_type mem_weight, const vertex_type_type vertex_type = 0) {
199-
200196
vertices_.emplace_back(vertices_.size(), work_weight, comm_weight, mem_weight, vertex_type);
201197
out_neigbors.push_back({});
202198
in_neigbors.push_back({});
@@ -231,7 +227,6 @@ class computational_dag_vector_impl {
231227
* @return True if the edge was added, false if it already exists or vertices are invalid.
232228
*/
233229
bool add_edge(const vertex_idx source, const vertex_idx target) {
234-
235230
if (source >= static_cast<vertex_idx>(vertices_.size()) || target >= static_cast<vertex_idx>(vertices_.size()) || source == target)
236231
return false;
237232

0 commit comments

Comments
 (0)