Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP
- Date: Tue, 06 Sep 2011 11:18:09 +0200
Hi Tom,
Try patching the file include/CGAL/Polynomial/Polynomial_type.h
as follow.
Sebastien.
@@ -44,6 +44,10 @@
#include <sstream>
#include <CGAL/Polynomial/misc.h>
+#ifdef CGAL_HAS_THREADS
+# include <boost/thread/tss.hpp>
+#endif
+
namespace CGAL {
template <class NT> class Polynomial;
@@ -261,8 +265,15 @@
//
private:
static Self& get_default_instance(){
- static Self x = Self(0);
- return x;
+ #ifdef CGAL_HAS_THREADS
+ static boost::thread_specific_ptr< Self > safe_x_ptr;
+ if (safe_x_ptr.get() == NULL)
+ safe_x_ptr.reset(new Self(0));
+ return *safe_x_ptr.get();
+ #else
+ static Self x = Self(0);
+ return x;
+ #endif
}
public:
//! \name Constructors
Tom Dreyfus wrote:
Hello,
I use the Algebraic_kernel_d_1 of CGAL for solving degree 4 equations.
When I use the solver in a *#pragma omp parallel for* directive, I have a segmentation fault.
However, I have no issue when there is only one thread.
I attached an example.
Thank you.
Tom.
- [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP, Tom Dreyfus, 09/05/2011
- Re: [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP, Eric Berberich, 09/06/2011
- Re: [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP, Sebastien Loriot (GeometryFactory), 09/06/2011
Archive powered by MHonArc 2.6.16.