Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bump: CGAL and Threadsafety

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bump: CGAL and Threadsafety


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] Bump: CGAL and Threadsafety
  • Date: Thu, 26 Jun 2008 21:21:42 +0200

Thomas Zangl - Home a écrit :
Am Sun, 8 Jun 2008 13:06:53 +0200, schrieb "Thomas Zangl - Home" <>:

Hi all!

I wrote the mail below on 8th June and did not receive any reply. Maybe
someone can comment on it? This would *greatly* help. Thank you!

Sorry, your mail was on my stack, but I got not much time to process it.

I want to use CGAL´s Delaunay Triangulation inside multiple threads
where each thread can run on a different CPU. I use boost::thread and the
threadpool from threadpool.sf.net.
What do I need to obey if I want to use CGAL with multiple threads? How
threadsafe are the triangulatione etc.?

As Laurent said, for CGAL 3.3, not much. We hope to have something better
for 3.4 though (at least for Delaunay_3).

In 3.3, you cannot insert/remove in parallel, even in disconnected areas,
since
the underlying container is not thread-safe. You should be able to iterate
over the vertices/faces in parallel though. You can dereference existing
handles in parallel as well.

I get various signal 11 errors when I e.g. ask for the dual of a Delaunay
Triangulation face and so on. Errors like this:
*** glibc detected *** corrupted double-linked list: 0x0d1f81b8 ***

Core dump says:
#0 0x0819dbac in _int_malloc ()
#1 0x0819f7e6 in malloc ()
#2 0x08172af8 in operator new ()
#3 0x080d3e04 in CGAL::Lazy_construction<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::To_interval<CGAL::Gmpq> > >, CGAL::CommonKernelFunctors::Construct_segment_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >,
CGAL::CommonKernelFunctors::Construct_segment_3<CGAL::Simple_cartesian<CGAL::Gmpq> > >::operator()<CGAL::Point_3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >,
CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::To_interval<CGAL::Gmpq> > > >, CGAL::Point_3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<f
al
s
e> >, CGAL::To_interval<CGAL::Gmpq> > > > > ()
#4 0x080d7cb6 in CGAL::DT3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::To_interval<CGAL::Gmpq> > >, CGAL::TDS3<CGAL::TH_vb3<CGAL::Triangulation_vertex_base_with_info_3<boost::shared_ptr<Isp>, CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::To_interval<CGAL::Gmpq> > >,
CGAL::T_vb3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >,
CGAL::To_interval<CGAL::Gmpq> > >, CGAL::TDS_vb3<void> > > >, CGAL::Triangulation_cell_base_with_info_3<boost::shared_ptr<DCellProp
er
t
y>, CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::To_interval<CGAL::Gmpq> > >, CGAL::T_cb3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >,
CGAL::To_interval<CGAL::Gmpq> > >, CGAL::TDS_cb3<void> > > > >::dual ()
#5 0x080cafd0 in DFacetProperty::setDual ()
#6 0x080d9143 in DCellProperty::insertFacets ()
#7 0x080dd258 in CComponent::dtriangulate ()
#8 0x080ddafa in CComponent::doWork ()
#9 0x0805d4bc in boost::function0<void, std::allocator<boost::function_base>
>::operator() ()
#10 0x0805d955 in
boost::threadpool::detail::worker_thread<boost::threadpool::detail::pool_core<boost::function0<void,
std::allocator<boost::function_base> >, boost::threadpool::fifo_scheduler,
boost::threadpool::static_size, boost::threadpool::resize_controller,
boost::threadpool::wait_for_all_tasks> >::run ()
#11 0x0805d4bc in boost::function0<void, std::allocator<boost::function_base>
>::operator() ()
#12 0x080f94de in thread_proxy ()
#13 0x0817e8f4 in pthread_start_thread (arg=0x13966840) at manager.c:310
#14 0x081ae73a in clone ()

Any ideas what can be wrong? (It works very fine if the code runs with
multiple threads on ONE CPU, but it starts failing if the threads are
distributed among 2 or more CPUs)

What kernel do you use, Exact_pred_exact_constructions it seems ?
This one would also have some thread-safety issues, e.g. copying
points between threads... Even the default constructed Point (or other
objects from this kernel) has a shared ref-counter...



I would be interested in knowing more details about your needs in this area.
(and from other people as well, if some subscribers have thread-safety
requirements)

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/



Archive powered by MHonArc 2.6.16.

Top of Page