Skip to content

Commit 36f9f9d

Browse files
improved lower bound on allready usage
1 parent 63f9a7d commit 36f9f9d

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace osp {
3434

3535
template <typename VertT, typename WeightT>
3636
struct GrowLocalSSPParams {
37-
VertT minSuperstepSize_ = 20;
37+
VertT minSuperstepSize_ = 10;
3838
WeightT syncCostMultiplierMinSuperstepWeight_ = 1;
3939
WeightT syncCostMultiplierParallelCheck_ = 4;
4040
};
@@ -50,13 +50,33 @@ class GrowLocalSSP : public MaxBspScheduler<GraphT> {
5050
static constexpr unsigned staleness{2U};
5151
GrowLocalSSPParams<VertexIdxT<GraphT>, VWorkwT<GraphT>> params_;
5252

53+
typename std::deque<VertexType>::difference_type maxAllReadyUsage(const std::deque<VertexType> &currentlyReady,
54+
const std::deque<VertexType> &nextSuperstepReady) const;
55+
5356
public:
5457
ReturnStatus ComputeSchedule(BspSchedule<GraphT> &schedule) override;
5558
ReturnStatus ComputeSchedule(MaxBspSchedule<GraphT> &schedule) override;
5659

5760
std::string GetScheduleName() const override { return "GrowLocalSSP"; }
5861
};
5962

63+
template <typename GraphT>
64+
typename std::deque<VertexIdxT<GraphT>>::difference_type GrowLocalSSP<GraphT>::maxAllReadyUsage(
65+
const std::deque<VertexIdxT<GraphT>> &currentlyReady, const std::deque<VertexIdxT<GraphT>> &nextSuperstepReady) const {
66+
if constexpr (staleness == 1U) {
67+
return std::distance(currentlyReady.cbegin(), currentlyReady.cend());
68+
} else {
69+
typename std::deque<VertexType>::difference_type lengthCurrently
70+
= std::distance(currentlyReady.cbegin(), currentlyReady.cend());
71+
typename std::deque<VertexType>::difference_type lengthNext
72+
= std::distance(nextSuperstepReady.cbegin(), nextSuperstepReady.cend());
73+
74+
typename std::deque<VertexType>::difference_type ans = ((lengthCurrently + lengthNext + 2) / 3) * 2;
75+
76+
return ans;
77+
}
78+
}
79+
6080
template <typename GraphT>
6181
ReturnStatus GrowLocalSSP<GraphT>::ComputeSchedule(BspSchedule<GraphT> &schedule) {
6282
MaxBspSchedule<GraphT> tmpSched(schedule.GetInstance());
@@ -131,13 +151,9 @@ ReturnStatus GrowLocalSSP<GraphT>::ComputeSchedule(MaxBspSchedule<GraphT> &sched
131151
std::inplace_merge(currentlyReady.begin(), std::next(currentlyReady.begin(), lengthCurrentlyReady), currentlyReady.end());
132152

133153
const typename std::deque<VertexType>::difference_type maxCurrentlyReadyUsage
134-
= (staleness == 1U) ? std::distance(currentlyReady.begin(), currentlyReady.end())
135-
: ((std::distance(currentlyReady.begin(), currentlyReady.end())
136-
+ std::distance(futureReady[(superStep + 1U) % staleness].begin(),
137-
futureReady[(superStep + 1U) % staleness].end())
138-
+ 2)
139-
/ 3)
140-
* 2;
154+
= std::max(static_cast<typename std::deque<VertexType>::difference_type>(
155+
static_cast<double>(params_.minSuperstepSize_) * desiredParallelism),
156+
maxAllReadyUsage(currentlyReady, futureReady[(superStep + 1U) % staleness]));
141157

142158
std::vector<std::vector<std::pair<VertexType, unsigned>>> &stepProcReady = procReady[reducedSuperStep];
143159
for (auto &procHeap : stepProcReady) {

0 commit comments

Comments
 (0)