Skip to content

Commit

Permalink
Add DRAKE_ASSERT statements to ensure programs being solved in parall…
Browse files Browse the repository at this point in the history
…el are actually threadsafe.
  • Loading branch information
cohnt committed Nov 21, 2024
1 parent 1f9b86b commit f1be911
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions geometry/optimization/convex_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ bool IsBoundedParallel(const ConvexSet& s, Parallelism parallelism) {
std::vector<MathematicalProgram> progs(parallelism.num_threads());
for (int i = 0; i < ssize(progs); ++i) {
ConstructEmptyBoundednessProgram(&(progs[i]), s);
DRAKE_ASSERT(progs[i].IsThreadSafe());
}

// Pre-allocate empty MathematicalProgramResults for each thread.
Expand Down
1 change: 1 addition & 0 deletions geometry/optimization/graph_of_convex_sets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ std::set<EdgeId> GraphOfConvexSets::PreprocessShortestPath(
EdgeId edge_id = idx_to_edge_id.at(i);
progs.emplace_back(ConstructPreprocessingProgram(
edge_id, incoming_edges, outgoing_edges, source_id, target_id));
DRAKE_ASSERT(progs.back()->IsThreadSafe());
}

// Check if edge e = (u,v) could be on a path from start to goal.
Expand Down

0 comments on commit f1be911

Please sign in to comment.