Bump CGAL → Boolean + remesh_*intersections performance boost#1895
Bump CGAL → Boolean + remesh_*intersections performance boost#1895alecjacobson merged 23 commits intomainfrom
Conversation
|
Great points, Jeremie! I believe this should be compatible with #1413 , when @qnzhou and I do the test, we should start with that one, then re-run this PR. Re our favorite #1805 , Daniele and I discussed a strategy for moving ahead this morning. We'll be in touch shortly. In terms of compatibility, I hope this PR is just bumping the commit hash, so easy merge but should be tested of course. |
… parallel-cgal
|
Update: CGAL v5.4 has been officially released. I've re-run the PWN subset of Thingi10k "self-union" stress test for the booleans. So far, 8595 out of 8621 have finished (a few take 10+ hours 🤯 ). All looks good in the sense of exactly matching rational output of the previous code. I'm content declaring success here (I'll try to squeeze out the last few models). I'd also like to test the success rate of the float conversion. This was never guaranteed and the heuristic we used in the paper was never implemented fully in C++ anyway. In any case, I'd like to get a sense of whether we significantly more often get poor snap rounding results with the new code. |
|
I'm nearly ready to declare success on this. I've run self-unions all 8620 valid PWN models from thingi10k. The new code produces exact (as in The new code also introduces new, faster rounding. Of these 8620 exact outputs, I first detect any self-intersections in the exact representations. After the #2019 fix, the new and old code agree there are no intersections. Then I convert to double (via |
|
I've put my scripts for the batch jobs at https://github.com/alecjacobson/thingi10k-bool-test , we can also use this test and merge #1413. |
parallel_fors to CGAL routinesassign_scalarvector<vector<vector...types used in edge-adjacency navigationBefore getting too excited, there are a couple good reasons why we should wait to merge this:
1.
The downside to this bump is that the auto-generated template prototypes for CGAL::Epeck related things seems to have changed which means this PR has deleted all the old /cgal template instantiations. This PR should contain the (non Windows specific) template instantiations needed by the tutorial and tests.
2.
CGAL/cgal#5402 recently fixed the thread safety issues with the CGAL::Epeck::FT type. This immediately enables a lot of opportunities for parallelism in the
mesh_booleanandremesh_intersectionroutines. Previously, due to reference counting, even read operations were not threadsafe, so we had some extremestd::mutexusage and barely any benefit of parallelism.For example, on my 56-core macpro I'm seeing:
remesh_self_intersectionsmesh_boolean3.
While profiling and improving the performance of these routines, I've fixed other bottlenecks. Most notably, the
assignrelated conversions to and from CGAL's exact type are quite costly. We previously used a rounding from float→rational, which could be best thought of as "round to nearest float" in the absolute sense. After some tests (not exhaustive yet; see above), I'm coming to the conclusion this is overkill and usingCGAL::to_double( .exact() )is a safe and faster alternative (vaguely think of as "arbitrarily round down/up"). (see also CGAL/cgal#6000)4.
Unrelated to CGAL, the
mesh_booleancode uses manyvector<vector<vector<...type lists of lists. We've been previously trying to encourage use of theuECanduEEserialized arrays for edge-to-half-edge equivalence. This makes that change in relevant places related tomesh_booleaning. There are still a number ofvector<vector<vector<..., notably intriangle_triangle_adjacencythat are an eyesore (thought nowhere near the bottleneck ofmesh_boolean.other.
Various other clean up, documentation, function splittings, templates, etc. made along the way.