Skip to content

Commit 35cf291

Browse files
committed
removed local_in_out memconstraint
1 parent 26ec00f commit 35cf291

4 files changed

Lines changed: 0 additions & 142 deletions

File tree

include/osp/bsp/model/BspArchitecture.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ enum class MemoryConstraintType {
4646
GLOBAL, /** The memory bounds apply to the sum of memory weights of the nodes assigned to the same processor. */
4747
PERSISTENT_AND_TRANSIENT, /** Memory bounds apply to the sum of memory weights of nodes assigned to the same processor plus
4848
the maximum communication weight of a node assigned to a processor. */
49-
LOCAL_IN_OUT, /** Memory constraints are local in-out. Experimental. */
5049
LOCAL_INC_EDGES, /** Memory constraints are local incident edges. Experimental. */
5150
LOCAL_SOURCES_INC_EDGES /** Memory constraints are local source incident edges. Experimental. */
5251
};
@@ -65,8 +64,6 @@ inline const char *ToString(MemoryConstraintType type) {
6564
return "GLOBAL";
6665
case MemoryConstraintType::PERSISTENT_AND_TRANSIENT:
6766
return "PERSISTENT_AND_TRANSIENT";
68-
case MemoryConstraintType::LOCAL_IN_OUT:
69-
return "LOCAL_IN_OUT";
7067
case MemoryConstraintType::LOCAL_INC_EDGES:
7168
return "LOCAL_INC_EDGES";
7269
case MemoryConstraintType::LOCAL_SOURCES_INC_EDGES:

include/osp/bsp/model/BspSchedule.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,6 @@ class BspSchedule : public IBspSchedule<GraphT>, public IBspScheduleEval<GraphT>
457457
case MemoryConstraintType::GLOBAL:
458458
return SatisfiesGlobalMemoryConstraints();
459459

460-
case MemoryConstraintType::LOCAL_IN_OUT:
461-
return SatisfiesLocalInOutMemoryConstraints();
462-
463460
case MemoryConstraintType::LOCAL_INC_EDGES:
464461
return SatisfiesLocalIncEdgesMemoryConstraints();
465462

include/osp/bsp/scheduler/GreedySchedulers/MemoryConstraintModules.hpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -211,62 +211,6 @@ struct IsMemoryConstraintSchedule<
211211
template <typename T>
212212
inline constexpr bool isMemoryConstraintScheduleV = IsMemoryConstraintSchedule<T>::value;
213213

214-
template <typename GraphT>
215-
struct LocalInOutMemoryConstraint {
216-
static_assert(std::is_convertible_v<VCommwT<GraphT>, VMemwT<GraphT>>,
217-
"LocalInOutMemoryConstraint requires that memory and communication weights are convertible.");
218-
219-
using GraphImplT = GraphT;
220-
221-
const BspInstance<GraphT> *instance_;
222-
const BspSchedule<GraphT> *schedule_;
223-
224-
const unsigned *currentSuperstep_ = 0;
225-
226-
std::vector<VMemwT<GraphT>> currentProcMemory_;
227-
228-
LocalInOutMemoryConstraint() : instance_(nullptr), schedule_(nullptr) {}
229-
230-
inline void Initialize(const BspSchedule<GraphT> &schedule, const unsigned &supstepIdx) {
231-
currentSuperstep_ = &supstepIdx;
232-
schedule_ = &schedule;
233-
instance_ = &schedule_->GetInstance();
234-
currentProcMemory_.assign(instance_->NumberOfProcessors(), 0);
235-
236-
if (instance_->GetArchitecture().GetMemoryConstraintType() != MemoryConstraintType::LOCAL_IN_OUT) {
237-
throw std::invalid_argument("Memory constraint type is not LOCAL_IN_OUT");
238-
}
239-
}
240-
241-
inline bool CanAdd(const VertexIdxT<GraphT> &v, const unsigned proc) const {
242-
VMemwT<GraphT> incMemory
243-
= instance_->GetComputationalDag().VertexMemWeight(v) + instance_->GetComputationalDag().VertexCommWeight(v);
244-
245-
for (const auto &pred : instance_->GetComputationalDag().Parents(v)) {
246-
if (schedule_->AssignedProcessor(pred) == schedule_->AssignedProcessor(v)
247-
&& schedule_->AssignedSuperstep(pred) == *currentSuperstep_) {
248-
incMemory -= instance_->GetComputationalDag().VertexCommWeight(pred);
249-
}
250-
}
251-
252-
return currentProcMemory_[proc] + incMemory <= instance_->GetArchitecture().MemoryBound(proc);
253-
}
254-
255-
inline void Add(const VertexIdxT<GraphT> &v, const unsigned proc) {
256-
currentProcMemory_[proc]
257-
+= instance_->GetComputationalDag().VertexMemWeight(v) + instance_->GetComputationalDag().VertexCommWeight(v);
258-
259-
for (const auto &pred : instance_->GetComputationalDag().Parents(v)) {
260-
if (schedule_->AssignedProcessor(pred) == schedule_->AssignedProcessor(v)
261-
&& schedule_->AssignedSuperstep(pred) == *currentSuperstep_) {
262-
currentProcMemory_[proc] -= instance_->GetComputationalDag().VertexCommWeight(pred);
263-
}
264-
}
265-
}
266-
267-
inline void Reset(const unsigned proc) { currentProcMemory_[proc] = 0; }
268-
};
269-
270214
template <typename GraphT>
271215
struct LocalIncEdgesMemoryConstraint {
272216
using GraphImplT = GraphT;

tests/bsp_schedulers_mem_const.cpp

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -165,63 +165,6 @@ void RunTestPersistentTransientMemory(Scheduler<GraphT> *testScheduler) {
165165
}
166166
}
167167

168-
template <typename GraphT>
169-
void RunTestLocalInOutMemory(Scheduler<GraphT> *testScheduler) {
170-
// static_assert(std::is_base_of<Scheduler, T>::value, "Class is not a scheduler!");
171-
std::vector<std::string> filenamesGraph = TestGraphs();
172-
std::vector<std::string> filenamesArchitectures = TestArchitectures();
173-
174-
// Getting root git directory
175-
std::filesystem::path cwd = std::filesystem::current_path();
176-
std::cout << cwd << std::endl;
177-
while ((!cwd.empty()) && (cwd.filename() != "OneStopParallel")) {
178-
cwd = cwd.parent_path();
179-
std::cout << cwd << std::endl;
180-
}
181-
182-
for (auto &filenameGraph : filenamesGraph) {
183-
for (auto &filenameMachine : filenamesArchitectures) {
184-
std::string nameGraph = filenameGraph.substr(filenameGraph.find_last_of("/\\") + 1);
185-
nameGraph = nameGraph.substr(0, nameGraph.find_last_of("."));
186-
std::string nameMachine = filenameMachine.substr(filenameMachine.find_last_of("/\\") + 1);
187-
nameMachine = nameMachine.substr(0, nameMachine.rfind("."));
188-
189-
std::cout << std::endl << "Scheduler: " << testScheduler->GetScheduleName() << std::endl;
190-
std::cout << "Graph: " << nameGraph << std::endl;
191-
std::cout << "Architecture: " << nameMachine << std::endl;
192-
193-
BspInstance<GraphT> instance;
194-
195-
bool statusGraph = file_reader::ReadComputationalDagHyperdagFormatDB((cwd / filenameGraph).string(),
196-
instance.GetComputationalDag());
197-
bool statusArchitecture
198-
= file_reader::ReadBspArchitecture((cwd / "data/machine_params/p3.arch").string(), instance.GetArchitecture());
199-
200-
AddMemWeights(instance.GetComputationalDag());
201-
instance.GetArchitecture().SetMemoryConstraintType(MemoryConstraintType::LOCAL_IN_OUT);
202-
std::cout << "Memory constraint type: LOCAL_IN_OUT" << std::endl;
203-
204-
if (!statusGraph || !statusArchitecture) {
205-
std::cout << "Reading files failed." << std::endl;
206-
BOOST_CHECK(false);
207-
}
208-
209-
const std::vector<VMemwT<GraphT>> boundsToTest = {10, 20, 50, 100};
210-
211-
for (const auto &bound : boundsToTest) {
212-
instance.GetArchitecture().SetMemoryBound(bound);
213-
214-
BspSchedule<GraphT> schedule(instance);
215-
const auto result = testScheduler->ComputeSchedule(schedule);
216-
217-
BOOST_CHECK_EQUAL(ReturnStatus::OSP_SUCCESS, result);
218-
BOOST_CHECK(schedule.SatisfiesPrecedenceConstraints());
219-
BOOST_CHECK(schedule.SatisfiesMemoryConstraints());
220-
}
221-
}
222-
}
223-
}
224-
225168
template <typename GraphT>
226169
void RunTestLocalIncEdgesMemory(Scheduler<GraphT> *testScheduler) {
227170
// static_assert(std::is_base_of<Scheduler, T>::value, "Class is not a scheduler!");
@@ -342,9 +285,6 @@ BOOST_AUTO_TEST_CASE(GreedyBspSchedulerLocalTest) {
342285
GreedyBspScheduler<GraphImplT, LocalMemoryConstraint<GraphImplT>> test1;
343286
RunTestLocalMemory(&test1);
344287

345-
GreedyBspScheduler<GraphImplT, LocalInOutMemoryConstraint<GraphImplT>> test2;
346-
RunTestLocalInOutMemory(&test2);
347-
348288
GreedyBspScheduler<GraphImplT, LocalIncEdgesMemoryConstraint<GraphImplT>> test3;
349289
RunTestLocalIncEdgesMemory(&test3);
350290

@@ -358,9 +298,6 @@ BOOST_AUTO_TEST_CASE(GrowLocalAutoCoresLocalTest) {
358298
GrowLocalAutoCores<GraphImplT, LocalMemoryConstraint<GraphImplT>> test1;
359299
RunTestLocalMemory(&test1);
360300

361-
GrowLocalAutoCores<GraphImplT, LocalInOutMemoryConstraint<GraphImplT>> test2;
362-
RunTestLocalInOutMemory(&test2);
363-
364301
GrowLocalAutoCores<GraphImplT, LocalIncEdgesMemoryConstraint<GraphImplT>> test3;
365302
RunTestLocalIncEdgesMemory(&test3);
366303

@@ -374,9 +311,6 @@ BOOST_AUTO_TEST_CASE(BspLockingLocalTest) {
374311
BspLocking<GraphImplT, LocalMemoryConstraint<GraphImplT>> test1;
375312
RunTestLocalMemory(&test1);
376313

377-
BspLocking<GraphImplT, LocalInOutMemoryConstraint<GraphImplT>> test2;
378-
RunTestLocalInOutMemory(&test2);
379-
380314
BspLocking<GraphImplT, LocalIncEdgesMemoryConstraint<GraphImplT>> test3;
381315
RunTestLocalIncEdgesMemory(&test3);
382316

@@ -389,20 +323,6 @@ BOOST_AUTO_TEST_CASE(VarianceLocalTest) {
389323
RunTestLocalMemory(&test);
390324
}
391325

392-
// BOOST_AUTO_TEST_CASE(kl_local_test) {
393-
394-
// VarianceFillup<ComputationalDagEdgeIdxVectorImplDefT,
395-
// LocalMemoryConstraint<ComputationalDagEdgeIdxVectorImplDefT>>
396-
// test;
397-
398-
// kl_total_comm<ComputationalDagEdgeIdxVectorImplDefT,
399-
// local_search_local_memory_constraint<ComputationalDagEdgeIdxVectorImplDefT>> kl;
400-
401-
// ComboScheduler<ComputationalDagEdgeIdxVectorImplDefT> combo_test(test, kl);
402-
403-
// run_test_local_memory(&combo_test);
404-
// };
405-
406326
BOOST_AUTO_TEST_CASE(GreedyBspSchedulerPersistentTransientTest) {
407327
GreedyBspScheduler<ComputationalDagEdgeIdxVectorImplDefT, PersistentTransientMemoryConstraint<ComputationalDagEdgeIdxVectorImplDefT>>
408328
test;

0 commit comments

Comments
 (0)