Skip to content
Merged
Changes from 1 commit
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
14 changes: 4 additions & 10 deletions libgalois/include/galois/worklists/AdaptiveObim.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {
((double)(p.slowPopsLastPeriod) / (double)(p.sinceLastFix)) >
1.0 / (double)(chunk_size)) {
for (unsigned i = 1; i < runtime::activeThreads; ++i) {
while (current.getRemote(i)->lock.try_lock())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is the culprit - something is missing!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find. That totally explains why it was broken before. Thanks!

;
current.getRemote(i)->lock.lock();
}
unsigned long priosCreatedThisPeriod = 0;
unsigned long numPushesThisStep = 0;
Expand Down Expand Up @@ -358,8 +357,7 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {
delta = 0;

for (unsigned i = 1; i < runtime::activeThreads; ++i) {
while (current.getRemote(i)->lock.try_lock())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto!

;
current.getRemote(i)->lock.lock();
}

for (unsigned i = 0; i < runtime::activeThreads; ++i) {
Expand Down Expand Up @@ -473,8 +471,7 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {

void push(const value_type& val) {
ThreadData& p = *current.getLocal();
while (!p.lock.try_lock())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit lock here is fine. I prefer to start a new issue/pr for replacing some explicit lock with std::lock_guard if necessary.

;
std::lock_guard<substrate::PaddedLock<Concurrent>> lk{p.lock};
Index ind = indexer(val);
deltaIndex index;
index.k = ind;
Expand All @@ -490,7 +487,6 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {
// Fast path
if (index == p.curIndex && p.current) {
p.current->push(val);
p.lock.unlock();
return;
}

Expand All @@ -507,7 +503,6 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {
p.current = lC;
}
lC->push(val);
p.lock.unlock();
}

template <typename Iter>
Expand All @@ -526,8 +521,7 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable {

galois::optional<value_type> pop() {
ThreadData& p = *current.getLocal();
while (!p.lock.try_lock())
;
p.lock.lock();

p.sinceLastFix++;

Expand Down