[Gmsh] Segmentation fault meshing over 100 million element

Andre Nicolle andre at cfdandip.co.uk
Fri Dec 16 11:33:17 CET 2011


Hi all,

I have been using Gmsh for many years and found it to be a great 
program. We are now expanding our calculations and now require bigger 
meshes but have started to find this to be a problem when meshing (using 
netgen) larger than 100 million elements. Our system has adequate RAM 
(256Gb) but gmsh exits with a segmentation fault, as shown below. At 
present we are using Ubuntu 10.04 64Bit AMD 6100. The problem can be 
found with 2.42, 2.5 and svn revision 10744 versions of the code. 
Interestingly for some reason the latest version of Gmsh crashes 
considerably sooner than the older versions.

Gmsh 2.50 and repository version were compiled using gcc version 4.4.3, 
Atlas Blas with the following command:
cmake ../CMakeLists.txt -DENABLE_FLTK=0

2.42 was from ubuntu repository

The meshing command is:

gmsh box3d.geo -3 -bin -algo front3d -optimize_netgen -smooth 5 -clscale 
1.0 -rand 1.e-8 -o box_c_new.msh

The box3d.geo file is very simple box with resolutions (0.002) set on 
the points as can be seen below .

To help find the problem I have tried to recompile Gmsh with debugging 
on. I'm not sure which flags got set.

cmake ../CMakeLists.txt -DENABLE_FLTK=0 -DCMAKE_BUILD_TYPE=Debug

and rerun Gmsh using gdb, output below:

The error seems to be generated in Netgen moveablemem.cpp which has 
disappeared in the latest version of Netgen 4.9 anyway. Given that Gmsh 
is still using Netgen 4.5, is it possible to link to the later version 
of netgen library installed locally instead of the built-in version to 
see if this helps.

Thanks

Andre

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

RES = 0.002;
Point(1) = {0, 0, 0, RES};
Point(2) = {1, 0, 0, RES};
Point(3) = {1, 0, 1, RES};
Point(4) = {0, 0, 1, RES};
Point(5) = {0, 1, 0, RES};
Point(6) = {1, 1, 0, RES};
Point(7) = {1, 1, 1, RES};
Point(8) = {0, 1, 1, RES};
Line (1) = {1, 2};
Line (2) = {2, 3};
Line (3) = {3, 4};
Line (4) = {4, 1};
Line (5) = {1, 5};
Line (6) = {5, 6};
Line (7) = {6, 2};
Line (8) = {5, 8};
Line (9) = {8, 4};
Line (10) = {8, 7};
Line (11) = {7, 6};
Line (12) = {7, 3};
Line Loop (15) = {1, 2, 3, 4};
Plane Surface (16) = {15};
Line Loop (17) = {12, -2, -7, -11};
Plane Surface (18) = {17};
Line Loop (19) = {3, -9, 10, 12};
Plane Surface (20) = {19};
Line Loop (21) = {10, 11, -6, 8};
Plane Surface (22) = {21};
Line Loop (23) = {8, 9, 4, 5};
Plane Surface (24) = {23};
Line Loop (25) = {6, 7, -1, 5};
Plane Surface (26) = {25};
Surface Loop(27) = {20, 16, 26, 22, 18, 24};
Volume(28) = {27};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Info    : Started on Thu Dec 15 20:45:53 2011
Info    : Reading 'box3d.geo'...
Info    : Done reading 'box3d.geo'
Info    : Meshing 1D...
Info    : Meshing curve 1 (Line)
Info    : Meshing curve 2 (Line)
Info    : Meshing curve 3 (Line)
Info    : Meshing curve 4 (Line)
Info    : Meshing curve 5 (Line)
Info    : Meshing curve 6 (Line)
Info    : Meshing curve 7 (Line)
Info    : Meshing curve 8 (Line)
Info    : Meshing curve 9 (Line)
Info    : Meshing curve 10 (Line)
Info    : Meshing curve 11 (Line)
Info    : Meshing curve 12 (Line)
Info    : Done meshing 1D (0.01 s)
Info    : Meshing 2D...
Info    : Meshing surface 16 (Plane, Delaunay)
Info    : Meshing surface 18 (Plane, Delaunay)
Info    : Meshing surface 20 (Plane, Delaunay)
Info    : Meshing surface 22 (Plane, Delaunay)
Info    : Meshing surface 24 (Plane, Delaunay)
Info    : Meshing surface 26 (Plane, Delaunay)
Info    : Done meshing 2D (603.87 s)
Info    : Meshing 3D...
Info    : Meshing volume 28 (Frontal)
Info    : Region 28 Face 20, 0 intersect
Info    : Region 28 Face 16, 1 intersect
Info    : Region 28 Face 26, 1 intersect
Info    : Region 28 Face 22, 1 intersect
Info    : Region 28 Face 18, 1 intersect
Info    : Region 28 Face 24, 1 intersect
Info    : CalcLocalH: 1984450 Points 0 Elements 3968896 Surface Elements
Info    : Check subdomain 1 / 1
Info    : 3968896 open elements
Info    : Meshing subdomain 1 of 1
Info    : 3968896 open elements
Info    : Use internal rules
Info    : 3968896 open elements
Info    : Delaunay meshing
Info    : number of points: 1984450
Info    : blockfill local h
Info    : number of points: 44035686

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff577b1c3 in ?? () from /lib/libc.so.6
(gdb) where
#0  0x00007ffff577b1c3 in ?? () from /lib/libc.so.6
#1  0x00007ffff577ee83 in free () from /lib/libc.so.6
#2  0x0000000000f9c2cf in netgen::BaseMoveableMem::ReAlloc (
     this=0x7fffffffb3b8, s=12612)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/general/moveablemem.cpp:159
#3  0x0000000000f950e7 in netgen::MoveableMem<netgen::INDEX_3>::ReAlloc (
     this=0x7fffffffb3b8, s=1051)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/include/../general/moveablemem.hpp:63
#4  0x0000000000f94f2f in netgen::MoveableArray<netgen::INDEX_3, 
0>::SetSize (
     this=0x7fffffffb3b0, nsize=1051)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/include/../general/array.hpp:447
#5  0x0000000000f945c2 in 
netgen::BASE_INDEX_3_CLOSED_HASHTABLE::BaseSetSize (
     this=0x7fffffffb3b0, size=1051)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/general/hashtabl.cpp:294
#6  0x000000000105a6ba in netgen::INDEX_3_CLOSED_HASHTABLE<int>::SetSize (
     this=0x7fffffffb3b0, size=1051)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/include/../general/hashtabl.hpp:870
#7  0x000000000105a4ae in netgen::MeshNB::ResetFaceHT (this=0x7fffffffb3b0,
     size=1051)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/meshing/delaunay.cpp:144
#8  0x0000000001053a54 in netgen::AddDelaunayPoint (newpi=..., newp=...,
     tempels=..., mesh=..., tettree=..., meshnb=..., centers=..., 
radi2=...,
     connected=..., treesearch=..., freelist=..., list=..., insphere=...,
     closesphere=...)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/meshing/delaunay.cpp:496
#9  0x0000000001055625 in netgen::Delaunay1 (mesh=..., mp=...,
     adfront=0x205a4d90, tempels=..., oldnp=1984450, startel=..., pmin=...,
     pmax=...)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/meshing/delaunay.cpp:765
#10 0x0000000001055d9f in netgen::Meshing3::Delaunay (this=0x7fffffffd3f0,
     mesh=..., domainnr=1, mp=...)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/meshing/delaunay.cpp:816
#11 0x000000000106555b in netgen::MeshVolume (mp=..., mesh3d=...)
     at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/libsrc/meshing/meshfunc.cpp:192
#12 0x0000000000f92263 in nglib::NgAddOn_GenerateVolumeMesh 
(mesh=0x2078cdc0,
     maxh=1e+22) at 
/home/andre/gmsh/svn/gmsh/contrib/Netgen/nglib_addon.cpp:80
#13 0x0000000000b2a33e in meshGRegion::operator() (this=0x7fffffffe240,
     gr=0x1844820) at /home/andre/gmsh/svn/gmsh/Mesh/meshGRegion.cpp:883
#14 0x0000000000a79d90 in 
std::for_each<std::_Rb_tree_const_iterator<GRegion*>,
     at /usr/include/c++/4.4/bits/stl_algo.h:4200
#15 0x0000000000a7768c in Mesh3D (m=0x1833a20)
     at /home/andre/gmsh/svn/gmsh/Mesh/Generator.cpp:533
#16 0x0000000000a77c0d in GenerateMesh (m=0x1833a20, ask=3)
     at /home/andre/gmsh/svn/gmsh/Mesh/Generator.cpp:636
#17 0x000000000093e1b4 in GModel::mesh (this=0x1833a20, dimension=3)
     at /home/andre/gmsh/svn/gmsh/Geo/GModel.cpp:510
#18 0x00000000007c4c75 in GmshBatch ()
     at /home/andre/gmsh/svn/gmsh/Common/Gmsh.cpp:170
#19 0x00000000007c42e3 in main (argc=15, argv=0x7fffffffe5d8)
     at /home/andre/gmsh/svn/gmsh/Common/Main.cpp:27