Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL+GMP and multithreading crash

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL+GMP and multithreading crash


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL+GMP and multithreading crash
  • Date: Wed, 24 Jun 2009 13:45:51 +0200
  • Organization: INRIA


wrote:
hi,

i am using CGAL with exact arithmetic withGMP/MPFR.

I am running MSVC2005. To install CGAL i used CGAL-3.4-Setup.exe.
I compile with Multithreaded DLL (debug) runtime libs.

My app binds agains (for debug version) among other libs:
gmp-vc80-mt-gd.lib mpfr-vc80-mt-gd.lib CGAL_Core-vc80-mt-gd.lib CGAL-vc80-mt-gd.lib
To speed up computation i changed my algorithm to use more than one thread.

i found out, that copying a Polygon_2 as an input for the threads is causing my app to crash. it looks like:
Polygon_2 a;

// ... init a ...

Polygon_2 b_thread1;
Polygon_2 b_thread2;
Polygon_2 b_thread3;
Polygon_2 b_thread4;
b_thread1 = a;
b_thread2 = a;
b_thread3 = a;
b_thread4 = a;

// ... start 4 threads each using b_threadX

// CRASH

when i do a workaround like this to copy "a":

b_trheadX.push_back( Point_2( toDouble( a[0].x() ), toDouble( a[0].y() ) ) );

there is no crash.

It looks like assigining:
b_threadX = a;
does not realy do a seperate copy in memory and when using multiple threads
there happen evil things.

is there a clean way to do a copy of a Polygon_2 without that workaround? i
use exact numbers and toDouble() is rounding.

may it be a problem with CGAL-3.4-Setup.exe? maybe they are compiled not for
multithreading? any idea?

Which kernel are you using ?

Cartesian_kernel and Exact_predicates_exact_constructions_kernel both
use a reference counting mechanism which is not thread-safe.
In comparison, Simple_cartesian and
Exact_predicates_inexact_constructions_kernel
should both be fine.

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



Archive powered by MHonArc 2.6.16.

Top of Page