-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add DRAKE_ASSERT statements to ensure programs being solved in parallel are actually threadsafe. #22228
base: master
Are you sure you want to change the base?
Conversation
f1be911
to
c17d015
Compare
We recently added a couple pieces of code where we solve mathematical programs in parallel, without actually asserting that they're thread-safe. This isn't a problem, since they are thread-safe, but if someone changes these programs down the line and inadvertently makes them not-thread-safe, it could lead to very confusing errors. +@AlexandreAmice for feature review on this one? |
c17d015
to
b17a567
Compare
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.
You want to put the asserts right before solve.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee AlexandreAmice, needs platform reviewer assigned, needs at least two assigned reviewers
geometry/optimization/convex_set.cc
line 123 at r1 (raw file):
for (int i = 0; i < ssize(progs); ++i) { ConstructEmptyBoundednessProgram(&(progs[i]), s); DRAKE_ASSERT(progs[i].IsThreadSafe());
No need for this one here. Only need to check before calling solve
geometry/optimization/convex_set.cc
line 161 at r1 (raw file):
progs[thread_num].linear_costs()[0].evaluator()->update_coefficient_entry( dimension, maximize ? -1 : 1); solver_interfaces[thread_num]->Solve(progs[thread_num], std::nullopt,
Put the asserts before Solve
…el are actually threadsafe.
b17a567
to
8ffa0ad
Compare
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.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee AlexandreAmice, needs platform reviewer assigned, needs at least two assigned reviewers
geometry/optimization/convex_set.cc
line 123 at r1 (raw file):
Previously, AlexandreAmice (Alexandre Amice) wrote…
No need for this one here. Only need to check before calling solve
Done.
geometry/optimization/convex_set.cc
line 161 at r1 (raw file):
Previously, AlexandreAmice (Alexandre Amice) wrote…
Put the asserts before
Solve
Done.
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.
Reviewed 1 of 1 files at r2.
Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers
This change is