Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP

Subject: CGAL users discussion list

List archive

[cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP


Chronological Thread 
  • From: Tom Dreyfus <>
  • To:
  • Subject: [cgal-discuss] Algebraic_kernel_d_1 and multi threading with OpenMP
  • Date: Mon, 5 Sep 2011 23:58:13 +0200 (CEST)

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.



#ifndef CGAL_USE_MPFI
#define CGAL_USE_MPFI
#endif

#ifdef CGAL_USE_MPFI

#include <CGAL/Algebraic_kernel_d_1.h>
#include <CGAL/Gmpz.h>

#include <omp.h>

#define M 100000

typedef CGAL::Gmpz                            Gmpz;
typedef CGAL::Algebraic_kernel_d_1<Gmpz>      AK_1;
typedef AK_1::Algebraic_real_1                Algebraic_real_1;
typedef AK_1::Polynomial_1                    Polynomial_1;
typedef AK_1::Solve_1                         Solve_1;

int main()
{

  AK_1 ak;
  Solve_1 solver = ak.solve_1_object();

#pragma omp parallel for
  for(unsigned i = 0; i < M; i++){
    std::vector<Algebraic_real_1> roots;
    Polynomial_1 l = CGAL::shift(Polynomial_1(1),1);
    Polynomial_1 P = l*l - 1;
    solver(P,false,std::back_inserter(roots));
  }

  return 0;
}
#else

int main()
{
  std::cout << "This example requires CGAL to be configured with library MPFI." << std::endl;

  return 0;
}


#endif
 



Archive powered by MHonArc 2.6.16.

Top of Page