-
Notifications
You must be signed in to change notification settings - Fork 140
Fix assertion failure from erroneous unlock in Adaptive OBIM. #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
insertinterestingnamehere
merged 3 commits into
IntelligentSoftwareSystems:master
from
insertinterestingnamehere:pmod_fix
Jul 27, 2020
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b294260
Fix assertion failure from erroneous unlock in Adaptive OBIM.
insertinterestingnamehere 8ad77b8
Fix lock and divided-by-zero bugs. Rename variables by the convention…
bozhiyou c9d964b
Fix init value of earliest; update code structure w.r.t OBIM
bozhiyou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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()) | ||
| ; | ||
| current.getRemote(i)->lock.lock(); | ||
| } | ||
| unsigned long priosCreatedThisPeriod = 0; | ||
| unsigned long numPushesThisStep = 0; | ||
|
|
@@ -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()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
|
@@ -473,8 +471,7 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable { | |
|
|
||
| void push(const value_type& val) { | ||
| ThreadData& p = *current.getLocal(); | ||
| while (!p.lock.try_lock()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
@@ -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; | ||
| } | ||
|
|
||
|
|
@@ -507,7 +503,6 @@ struct AdaptiveOrderedByIntegerMetric : private boost::noncopyable { | |
| p.current = lC; | ||
| } | ||
| lC->push(val); | ||
| p.lock.unlock(); | ||
| } | ||
|
|
||
| template <typename Iter> | ||
|
|
@@ -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++; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
!There was a problem hiding this comment.
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!