-
Notifications
You must be signed in to change notification settings - Fork 137
remove deterministic flag #1033
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,35 +468,32 @@ std::shared_ptr<Manifold::Impl> CsgOpNode::BatchBoolean( | |
return std::make_shared<Manifold::Impl>(boolean.Result(operation)); | ||
} | ||
#if (MANIFOLD_PAR == 1) && __has_include(<tbb/tbb.h>) | ||
if (!ManifoldParams().deterministic) { | ||
tbb::task_group group; | ||
tbb::concurrent_priority_queue<SharedImpl, MeshCompare> queue( | ||
results.size()); | ||
for (auto result : results) { | ||
queue.emplace(result); | ||
} | ||
results.clear(); | ||
std::function<void()> process = [&]() { | ||
while (queue.size() > 1) { | ||
SharedImpl a, b; | ||
if (!queue.try_pop(a)) continue; | ||
if (!queue.try_pop(b)) { | ||
queue.push(a); | ||
continue; | ||
} | ||
group.run([&, a, b]() { | ||
Boolean3 boolean(*getImplPtr(a), *getImplPtr(b), operation); | ||
queue.emplace( | ||
std::make_shared<Manifold::Impl>(boolean.Result(operation))); | ||
return group.run(process); | ||
}); | ||
} | ||
}; | ||
group.run_and_wait(process); | ||
SharedImpl r; | ||
queue.try_pop(r); | ||
return *std::get_if<std::shared_ptr<Manifold::Impl>>(&r); | ||
tbb::task_group group; | ||
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. This one had a noticeable perf impact when removed, but not huge. |
||
tbb::concurrent_priority_queue<SharedImpl, MeshCompare> queue(results.size()); | ||
for (auto result : results) { | ||
queue.emplace(result); | ||
} | ||
results.clear(); | ||
std::function<void()> process = [&]() { | ||
while (queue.size() > 1) { | ||
SharedImpl a, b; | ||
if (!queue.try_pop(a)) continue; | ||
if (!queue.try_pop(b)) { | ||
queue.push(a); | ||
continue; | ||
} | ||
group.run([&, a, b]() { | ||
Boolean3 boolean(*getImplPtr(a), *getImplPtr(b), operation); | ||
queue.emplace( | ||
std::make_shared<Manifold::Impl>(boolean.Result(operation))); | ||
return group.run(process); | ||
}); | ||
} | ||
}; | ||
group.run_and_wait(process); | ||
SharedImpl r; | ||
queue.try_pop(r); | ||
return *std::get_if<std::shared_ptr<Manifold::Impl>>(&r); | ||
#endif | ||
// apply boolean operations starting from smaller meshes | ||
// the assumption is that boolean operations on smaller meshes is faster, | ||
|
@@ -604,10 +601,8 @@ std::vector<std::shared_ptr<CsgNode>> &CsgOpNode::GetChildren( | |
|
||
if (forceToLeafNodes && !impl->forcedToLeafNodes_) { | ||
impl->forcedToLeafNodes_ = true; | ||
for_each(impl->children_.size() > 1 && !ManifoldParams().deterministic | ||
? ExecutionPolicy::Par | ||
: ExecutionPolicy::Seq, | ||
impl->children_.begin(), impl->children_.end(), [](auto &child) { | ||
for_each(ExecutionPolicy::Par, impl->children_.begin(), | ||
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. Changing this to |
||
impl->children_.end(), [](auto &child) { | ||
if (child->GetNodeType() != CsgNodeType::Leaf) { | ||
child = child->ToLeafNode(); | ||
} | ||
|
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.
@pca006132 Actually, switching this to serial had the smallest performance impact of anything, but for now I'm going with the
determinism == false
path for everything.