Subject: CGAL users discussion list
List archive
- From: Marc Glisse <>
- To:
- Subject: Re: Re: [cgal-discuss] CGAL+GMP and multithreading crash
- Date: Tue, 1 May 2012 17:21:04 +0200 (CEST)
On Tue, 1 May 2012, Ioannis wrote:
It is not possible to make reference-counting thread-safe without slowing
down single-threaded applications, so this hasn't been done yet. It is
safe to use different Gmpq in different threads (as opposed to Gmpzf which
may only be used in a single thread), but not to share one between
threads.
You could try to use a type that does not use reference counting
(mpq_class (from gmpxx.h) instead of Gmpq).
I am using CCAL 4.0 with with Exact_predicates_exact_constructions kernel
and my multithreaded code fails occasionally.
Is the thread unsafe reference counting still an issue in the new version?
The same problem I have with multithreading and the Cartesian<Cgal::Gmpq>
kernel.
Yes, the paragraph you quoted is still valid. I guess we'll have to provide an option to make reference-counting thread-safe (and slower) at some point, for Gmpq it shouldn't be hard, especially if we use C++11 and don't try to squeeze the last microsecond of performance out of it. For other types (including the kernel objects in Exact_predicates_exact_constructions), it might be a bit harder as the interface wasn't written with atomicity in mind.
Is the Simple_cartesian<mpq_class> the only alternative solution and how
slow could that be comparing to the other kernels?
Compared to Cartesian<Gmpq>, and assuming objects aren't copied around all the time, it should be about the same. Compared to Exact_predicates_exact_constructions, it can be quite a bit slower.
I saw in an older post that some filtering could speed it up but I am not
sure what does that mean in this context and how can I use it in my code.
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Filtered_kernel.html
--
Marc Glisse
- Re: Re: [cgal-discuss] CGAL+GMP and multithreading crash, Ioannis, 05/01/2012
- Re: Re: [cgal-discuss] CGAL+GMP and multithreading crash, Marc Glisse, 05/01/2012
Archive powered by MHonArc 2.6.16.