Skip to content

Commit 26ec00f

Browse files
committed
satisfiesLocalConstraint revision
1 parent da183ee commit 26ec00f

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

include/osp/bsp/model/BspSchedule.hpp

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,17 @@ class BspSchedule : public IBspSchedule<GraphT>, public IBspScheduleEval<GraphT>
605605
* @return True if local memory constraints are satisfied, false otherwise.
606606
*/
607607
bool SatisfiesLocalMemoryConstraints() const {
608-
SetSchedule setSchedule = SetSchedule(*this);
608+
std::vector<std::vector<VMemwT<GraphT>>> memory(numberOfSupersteps_,
609+
std::vector<VMemwT<GraphT>>(instance_->NumberOfProcessors(), 0));
610+
611+
for (const auto &node : instance_->Vertices()) {
612+
memory[nodeToSuperstepAssignment_[node]][nodeToProcessorAssignment_[node]]
613+
+= instance_->GetComputationalDag().VertexMemWeight(node);
614+
}
609615

610616
for (unsigned step = 0; step < numberOfSupersteps_; step++) {
611617
for (unsigned proc = 0; proc < instance_->NumberOfProcessors(); proc++) {
612-
VMemwT<GraphT> memory = 0;
613-
for (const auto &node : setSchedule.GetProcessorStepVertices()[step][proc]) {
614-
memory += instance_->GetComputationalDag().VertexMemWeight(node);
615-
}
616-
617-
if (memory > instance_->GetArchitecture().MemoryBound(proc)) {
618+
if (memory[step][proc] > instance_->GetArchitecture().MemoryBound(proc)) {
618619
return false;
619620
}
620621
}
@@ -671,32 +672,6 @@ class BspSchedule : public IBspSchedule<GraphT>, public IBspScheduleEval<GraphT>
671672
return true;
672673
}
673674

674-
bool SatisfiesLocalInOutMemoryConstraints() const {
675-
SetSchedule setSchedule = SetSchedule(*this);
676-
677-
for (unsigned step = 0; step < numberOfSupersteps_; step++) {
678-
for (unsigned proc = 0; proc < instance_->NumberOfProcessors(); proc++) {
679-
VMemwT<GraphT> memory = 0;
680-
for (const auto &node : setSchedule.GetProcessorStepVertices()[step][proc]) {
681-
memory += instance_->GetComputationalDag().VertexMemWeight(node)
682-
+ instance_->GetComputationalDag().VertexCommWeight(node);
683-
684-
for (const auto &parent : instance_->GetComputationalDag().Parents(node)) {
685-
if (nodeToProcessorAssignment_[parent] == proc && nodeToSuperstepAssignment_[parent] == step) {
686-
memory -= instance_->GetComputationalDag().VertexCommWeight(parent);
687-
}
688-
}
689-
}
690-
691-
if (memory > instance_->GetArchitecture().MemoryBound(proc)) {
692-
return false;
693-
}
694-
}
695-
}
696-
697-
return true;
698-
}
699-
700675
bool SatisfiesLocalIncEdgesMemoryConstraints() const {
701676
SetSchedule setSchedule = SetSchedule(*this);
702677

0 commit comments

Comments
 (0)