Parallelism of the function AABB_tree::closest_point_and_primitive()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Parallelism of the function AABB_tree::closest_point_and_primitive()

Yana Nehme
Hi,

I want to parallelise, with OpenMP, a matching process based on the AABB
Tree.
Indeed, we have 2 meshes: the reference ("m_poly_original") and the
distorded model ("m_poly_degrad" having a PointMap "pm_degrad"). For each
vertex of the distorted mesh, we compute its nearest 3D point on the surface
of the reference model using the AABB tree structure. For parallel
execution, we use the OpenMP parallel loop. The code is as follows:

auto original_faces = faces(m_poly_original);

FaceIterator orig_begin = original_faces.first;
FaceIterator orig_end = original_faces.second;

AABB_Tree tree(orig_begin, orig_end, m_poly_original);
tree.accelerate_distance_queries();

#pragma omp parallel for
for (int i = 0; i < (int)num_vertices(m_poly_degrad); i++)
{
     Vertex_Descriptor vi(i);

    // computes closest point and primitive id
     Point_and_primitive_id pp =
tree.closest_point_and_primitive(get(pm_degrad, vi));
     auto f_nearest = pp.second; // closest primitive id
}


However, the program crashes with a critical error detected c0000374.

Note that, I am using visual studio Express 2015 (openMp version 2.0) on
Windows 10.

It is possible to parallize the function
AABB_tree::closest_point_and_primitive()? How can I handle this kind of
problem?

Any help would be greatly appreciated.

Regards,
Yana Nehme



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Parallelism of the function AABB_tree::closest_point_and_primitive()

Sebastien Loriot (GeometryFactory)
Before trying to make it running in parallel, did you try calling
tree.accelerate_distance_queries()?

This should greatly improve the runtime.

Sebastien.

On 9/5/19 2:33 PM, Yana Nehme wrote:

> Hi,
>
> I want to parallelise, with OpenMP, a matching process based on the AABB
> Tree.
> Indeed, we have 2 meshes: the reference ("m_poly_original") and the
> distorded model ("m_poly_degrad" having a PointMap "pm_degrad"). For each
> vertex of the distorted mesh, we compute its nearest 3D point on the surface
> of the reference model using the AABB tree structure. For parallel
> execution, we use the OpenMP parallel loop. The code is as follows:
>
> auto original_faces = faces(m_poly_original);
>
> FaceIterator orig_begin = original_faces.first;
> FaceIterator orig_end = original_faces.second;
>
> AABB_Tree tree(orig_begin, orig_end, m_poly_original);
> tree.accelerate_distance_queries();
>
> #pragma omp parallel for
> for (int i = 0; i < (int)num_vertices(m_poly_degrad); i++)
> {
>       Vertex_Descriptor vi(i);
>
>      // computes closest point and primitive id
>       Point_and_primitive_id pp =
> tree.closest_point_and_primitive(get(pm_degrad, vi));
>       auto f_nearest = pp.second; // closest primitive id
> }
>
>
> However, the program crashes with a critical error detected c0000374.
>
> Note that, I am using visual studio Express 2015 (openMp version 2.0) on
> Windows 10.
>
> It is possible to parallize the function
> AABB_tree::closest_point_and_primitive()? How can I handle this kind of
> problem?
>
> Any help would be greatly appreciated.
>
> Regards,
> Yana Nehme
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Parallelism of the function AABB_tree::closest_point_and_primitive()

Laurent Rineau (CGAL/GeometryFactory)
In reply to this post by Yana Nehme
On Thursday, September 5, 2019 2:33:34 PM CEST Yana Nehme wrote:

> AABB_Tree tree(orig_begin, orig_end, m_poly_original);
> tree.accelerate_distance_queries();
>
> #pragma omp parallel for
> for (int i = 0; i < (int)num_vertices(m_poly_degrad); i++)
> {
>      Vertex_Descriptor vi(i);
>
>     // computes closest point and primitive id
>      Point_and_primitive_id pp =
> tree.closest_point_and_primitive(get(pm_degrad, vi));
>      auto f_nearest = pp.second; // closest primitive id
> }
>
>
> However, the program crashes with a critical error detected c0000374.
>
> Note that, I am using visual studio Express 2015 (openMp version 2.0) on
> Windows 10.
>
> It is possible to parallize the function
> AABB_tree::closest_point_and_primitive()? How can I handle this kind of
> problem?

`AABB_tree::closest_point_and_primitive` is const, and you should be able to
call it in parallel. Which CGAL version have you used?

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory           http://www.geometryfactory.com/
Release Manager of the CGAL Project       http://www.cgal.org/




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Parallelism of the function AABB_tree::closest_point_and_primitive()

Yana Nehme
I am using CGAL-4.14.



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss