Skip to content

Make the kd-tree build really lazy and fix thread safety of builds#4675

Merged
sloriot merged 20 commits intoCGAL:masterfrom
sloriot:AABB_tree-cpp11DCL
May 5, 2020
Merged

Make the kd-tree build really lazy and fix thread safety of builds#4675
sloriot merged 20 commits intoCGAL:masterfrom
sloriot:AABB_tree-cpp11DCL

Conversation

@sloriot
Copy link
Member

@sloriot sloriot commented Apr 22, 2020

Follow up of #4244 + document explicitely what is done.

The PR is on purpose for 5.1 only.

void clear_search_tree()
{
#ifdef CGAL_HAS_THREADS
if ( m_atomic_search_tree_constructed.load() )
Copy link
Member

Choose a reason for hiding this comment

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

As you choose to use the full API of std::atomic, you can as well pass the right std::memory_order argument:

Suggested change
if ( m_atomic_search_tree_constructed.load() )
if ( m_atomic_search_tree_constructed.load(std::memory_order_acquire) )

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should be relaxed since the variable is guaranteed not to be modified once we are in this function (which I thought was the default but is seq actually...).

Copy link
Member

Choose a reason for hiding this comment

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

That is right (relaxed). I had not seen in which function we were. Actually, in this function, the synchronization between threads and the performance do not really matter.

@sloriot sloriot force-pushed the AABB_tree-cpp11DCL branch from 1493553 to 0c98cd8 Compare April 22, 2020 14:53
delete m_p_search_tree;
m_p_search_tree = nullptr;
#ifdef CGAL_HAS_THREADS
m_atomic_search_tree_constructed.store(false);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
m_atomic_search_tree_constructed.store(false);
m_atomic_search_tree_constructed.store(false, std::memory_order_release);

@maxGimeno
Copy link
Contributor

maxGimeno commented Apr 23, 2020

ERROR: execution___of__point_inside_polyhedron_boundary_test in 1200.15 s : Timeout
ERROR: execution___of__point_inside_surface_mesh_test in 1200.08 s : Timeout
ERROR: execution___of__test_pmp_clip in 1200.08 s : Timeout .
and most docker platforms are timing out.

Also, (and pointed out by travis) : https://cgal.geometryfactory.com/CGAL/testsuite/results-5.1-Ic-132.shtml#Surface_mesh_simplification

@sloriot sloriot force-pushed the AABB_tree-cpp11DCL branch from 7bb1f2c to 0bfc045 Compare April 23, 2020 14:51
@maxGimeno
Copy link
Contributor

@maxGimeno
Copy link
Contributor

@maxGimeno
Copy link
Contributor

@sloriot sloriot self-assigned this May 5, 2020
@sloriot sloriot merged commit c67ef14 into CGAL:master May 5, 2020
@sloriot sloriot deleted the AABB_tree-cpp11DCL branch May 5, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants