Skip to content
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

Bug fix: avoid using caching in SurfaceSpatialIndex as this results i… #392

Conversation

Ghazi-Bouabene
Copy link
Member

…n different values for the same point when ran in parallel. Fixes issue #367

…n different values for the same point when ran in parallel
Copy link
Contributor

@marcelluethi marcelluethi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I cannot assess the implications of this change and need to defer to @Andreas-Forster. If it is fine for Andreas, it is okay for me.

@@ -188,7 +188,7 @@ private[mesh] class TriangleMesh3DSpatialIndex(private val bs: BoundingSphere,
val p = point.toVector

// last triangle might be a good candidate
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this comment does not fit the code anymore and should be updated.

Copy link
Member

@Andreas-Forster Andreas-Forster left a comment

Choose a reason for hiding this comment

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

I agree with the PR. It fixes the issue we have right now. While it might be that the PR makes the algorithm slightly slower, it is definitively deterministic.

When we need the last bit of performance we could later on check if there is a way to fix this issue, by improving the algorithm.

So I am fine with merging it.

@marcelluethi
Copy link
Contributor

@Andreas-Forster I realized only now that I don't understand the issue very well. Could you quickly comment on why taking the last points as a starting point makes it non-deterministic, while taking the head does not? Is this also due to numerical instabilities or is there a bug hidden somewhere that we should fix?

@Andreas-Forster
Copy link
Member

I did not debug it in detail. But I guess the tree traversal could be different for a point when you have a different initialization there. Just the order of visiting the nodes. I guess that sometimes then are two points found that have the (nearly) same distance and hence the order matters. Then starting always at the same point, makes the tree traversal agnostic of the last found point.

@marcelluethi marcelluethi changed the base branch from release-0.91 to release-0.92 June 29, 2023 12:14
@marcelluethi marcelluethi merged commit d72dd35 into unibas-gravis:release-0.92 Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants