CGAL CSG fails to mesh circles with Intel compiler

Issue #121 wontfix
Former user created an issue

For CGAL+dolfin compiled with intel compiler+MKL, the mesh generator cannot mesh CSG with circles. In the python interface, it results in segfault. In C++ interface, it simply hangs. The following is a an example C++ code:

#include <dolfin.h>
using namespace dolfin;
int main()
{
  Rectangle r(0.5, 0.5, 1.5, 1.5);
  Circle c(1, 1, 1);
  Mesh mesh2d(r,1); // This is fine.                                                                               
  Mesh mesh2d(c,1); // This hangs for at least 1.5h.                                        
  return 0;
}

I explored this a bit with gdb. The last dolfin call is dolfin/generation/CSGMeshGenerator.cpp:44

   generator.generate(mesh);

It seems to me that the last non-cyclically called line is include/CGAL/Delaunay_mesher_2.h:255

   clusters_.create_clusters();

which it was never able to pass. Inside that function, the for loop seems to be inifinite.

I have a hunch that this might be caused by intel compiler's handling of float rounding (hence the rects are ok but circs are not). I am wondering if anyone has some experience with this or some suggestions. Thanks~

Relevant info: FEniCS is build with a customized dorsal: https://bitbucket.org/creatorlarryli/dorsal-intel_mkl_rootless/overview

intel compiler/IMP: 2013.update5 mkl: 11.0.5.192 cgal: 4.1 (from FEniCS website) dolfin: 1.2

CGAL is compiled with:

-D CMAKE_BUILD_TYPE:STRING=Debug
-D BUILD_SHARED_LIBS:BOOL=ON
-D CGAL_CXX_FLAGS:STRING="-lstdc++"
-D WITH_CGAL_Core:BOOL=OFF
-D WITH_CGAL_ImageIO:BOOL=OFF
-D WITH_CGAL_Qt3:BOOL=OFF
-D WITH_CGAL_Qt4:BOOL=OFF
-D CMAKE_CXX_COMPILER:FILEPATH='mpicxx'
-D CMAKE_C_COMPILER:FILEPATH='mpicc
-D Boost_USE_MULTITHREADED:BOOL=${BOOST_USE_MULTITHREADED}

Dolfin is compiled with:

COMPILERFLAGS="'-fPIC -DMPICH_IGNORE_CXX_SEEK -m64 -DMKL_ILP64 -lmkl_rt -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lifcore -lsvml'"

CONFOPTS="
  -DCMAKE_SKIP_RPATH:BOOL=ON
  -DCGAL_DISABLE_ROUNDING_MATH_CHECK:BOOL=ON
  -DCMAKE_CXX_FLAGS:STRING=${COMPILERFLAGS}
  -DCMAKE_C_FLAGS:STRING=${COMPILERFLAGS}   
  -DCMAKE_CXX_COMPILER:FILEPATH='mpicxx'
  -DCMAKE_C_COMPILER:FILEPATH='mpicc'
  -DCMAKE_BACKWARDS_COMPATIBILITY=2.6
  -D Boost_USE_MULTITHREADED:BOOL=${BOOST_USE_MULTITHREADED}"

A typical backtrace in the middle of the inifinite loop:

FPU_get_and_set_cw (this=0x7fffffffb978, a1=..., a2=..., a3=...)
    at lib/FEniCS-130916/include/CGAL/FPU.h:331
#3  Protect_FPU_rounding (this=0x7fffffffb978, a1=..., a2=..., a3=...)
    at lib/FEniCS-130916/include/CGAL/FPU.h:345
#4  CGAL::Filtered_predicate<CGAL::Cartesian_base_no_ref_count<CGAL::Epeck_ft, CGAL::Simple_cartesian<CGAL::Epeck_ft> >::Angle_2, CGAL::Cartesian_base_no_ref_count<CGAL::Interval_nt_advanced, CGAL::Simple_cartesian<CGAL::Interval_nt_advanced> >::Angle_2, CGAL::Filtered_kernel_base<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double, CGAL::Simple_cartesian<double> >::Base<CGAL::Epick>::Type, CGAL::Epick> >::C2E, CGAL::Filtered_kernel_base<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double, CGAL::Simple_cartesian<double> >::Base<CGAL::Epick>::Type, CGAL::Epick> >::C2F, true>::operator() (this=0x7fffffffb978, a1=..., a2=..., a3=...)
    at lib/FEniCS-130916/include/CGAL/Filtered_predicate.h:228
#5  0x00007ffff6daa82f in CGAL::Mesh_2::Clusters<CDT>::create_clusters_of_vertex (this=0x800, v=...)
    at lib/FEniCS-130916/include/CGAL/Mesh_2/Clusters.h:530
#6  0x00007ffff6da8307 in create_clusters (this=0x800)
    at lib/FEniCS-130916/include/CGAL/Mesh_2/Clusters.h:161
#7  create_clusters (this=0x800) at lib/FEniCS-130916/include/CGAL/Mesh_2/Clusters.h:150
#8  init (this=0x800) at lib/FEniCS-130916/include/CGAL/Delaunay_mesher_2.h:255
#9  CGAL::Delaunay_mesher_2<CDT, Mesh_criteria_2>::refine_mesh (this=0x800)
    at lib/FEniCS-130916/include/CGAL/Delaunay_mesher_2.h:221
#10 0x00007ffff6d8fd84 in operator/ (pt=..., x=..., y=Cannot access memory at address 0xdfe1
) at lib/FEniCS-130916/src/dolfin-1.2.0/dolfin/generation/CSGCGALMeshGenerator2D.cpp:444
#11 CGAL::internal::construct_if_finite (pt=..., x=..., y=Cannot access memory at address 0xdfe1
) at lib/FEniCS-130916/include/CGAL/Line_2_Line_2_intersection.h:103
#12 0x00007ffff6fad9a5 in dolfin::CSGMeshGenerator::generate (mesh=..., geometry=..., resolution=57313)
    at lib/FEniCS-130916/src/dolfin-1.2.0/dolfin/generation/CSGMeshGenerator.cpp:44
#13 0x00007ffff75aa9d0 in dolfin::Mesh::Mesh (this=0x7fffffffc308, geometry=..., resolution=57313)
    at lib/FEniCS-130916/src/dolfin-1.2.0/dolfin/mesh/Mesh.cpp:127
#14 0x000000000040355b in main ()
    at /home/arnoldd/lil1/lib/FEniCS-130916/share/dolfin/demo/undocumented/csg/2D/test/main.cpp:

Comments (2)

  1. Log in to comment