Errors 1) DMPlexCreateBoxMesh with generator `tetgen` 2) ParMMG for DMPlex with overlap;
I wrote a Python script to test the DMCoarsen feature for DMPlex, but I encountered some errors.
The script is shown below:
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from petsc4py.PETSc import Sys, Viewer
import numpy as np
opts = PETSc.Options()
N = opts.getInt('N', 4)
dim = opts.getInt('dim', 3)
overlap = opts.getInt('overlap', 1)
faces = [N for _ in range(dim)]
plex = PETSc.DMPlex().createBoxMesh(faces, simplex=True)
PETSc.Sys.Print('\nDM after Create:')
plex.view(Viewer.STDOUT())
sf = plex.distribute(overlap=overlap)
PETSc.Sys.Print('\nDM overlap 1:')
plex.view(Viewer.STDOUT())
new_plex = plex.coarsen()
PETSc.Sys.Print('\nDM after coarsen:')
new_plex.view(Viewer.STDOUT())
I run it four times with different options:
python test_coarsen.py -dim 3 -overlap 0 -dm_adaptor mmg -dm_generator ctetgen # OK
python test_coarsen.py -dim 3 -overlap 0 -dm_adaptor mmg -dm_generator tetgen # Error of tetgen
mpiexec -n 2 python test_coarsen.py -dim 3 -overlap 0 -dm_adaptor parmmg -dm_generator ctetgen # OK
mpiexec -n 2 python test_coarsen.py -dim 3 -overlap 1 -dm_adaptor parmmg -dm_generator ctetgen # Error of parmmg
ParMMG for DMPlex with overlap
The output of command
mpiexec -n 2 python test_coarsen.py -dim 3 -overlap 1 -dm_adaptor parmmg -dm_generator ctetgen
is attached. parmmg.log
tetgen
Error of DMPlexCreateBoxMesh with generator Output of the backtrace for
python test_coarsen.py -dim 3 -overlap 0 -dm_adaptor mmg -dm_generator tetgen
is
$ python test_coarsen.py -dim 3 -dm_adaptor parmmg -dm_generator tetgen
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind and https://petsc.org/release/faq/
[0]PETSC ERROR: --------------------- Stack Frames ------------------------------------
[0]PETSC ERROR: The line numbers in the error traceback are not always exact.
[0]PETSC ERROR: #1 DMPlexGenerate_Tetgen() at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/generators/tetgen/tetgenerate.cxx:137
[0]PETSC ERROR: #2 DMPlexGenerate() at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexgenerate.c:185
[0]PETSC ERROR: #3 DMPlexCreateBoxMesh_Simplex_Internal() at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:825
[0]PETSC ERROR: #4 DMPlexCreateBoxMesh_Internal() at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:1293
[0]PETSC ERROR: #5 DMPlexCreateBoxMesh() at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:1379
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59
:
system msg for write_line failure : Bad file descriptor
Debug logs:
+r
Starting program: /home/yzz/firedrake/real-int32-mkl-debug/bin/python test_coarsen.py -dim 3 -dm_adaptor parmmg -dm_generator tetgen
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe555f640 (LWP 9274)]
[New Thread 0x7fffdcd5e640 (LWP 9275)]
[New Thread 0x7fffd455d640 (LWP 9276)]
[New Thread 0x7fffcbd5c640 (LWP 9277)]
[New Thread 0x7fffcb55b640 (LWP 9278)]
[New Thread 0x7fffbad5a640 (LWP 9279)]
[New Thread 0x7fffb2559640 (LWP 9280)]
[New Thread 0x7fffa9d58640 (LWP 9281)]
[New Thread 0x7fffa1557640 (LWP 9282)]
[New Thread 0x7fff98d56640 (LWP 9283)]
[New Thread 0x7fff90555640 (LWP 9284)]
[New Thread 0x7fff8fd54640 (LWP 9285)]
[New Thread 0x7fff7f553640 (LWP 9286)]
[New Thread 0x7fff7ed52640 (LWP 9287)]
[New Thread 0x7fff7e551640 (LWP 9288)]
[New Thread 0x7fff6dd50640 (LWP 9289)]
[New Thread 0x7fff6554f640 (LWP 9290)]
[New Thread 0x7fff54d4e640 (LWP 9291)]
[New Thread 0x7fff5454d640 (LWP 9292)]
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007ffff6b3e75a in tetgenmesh::identifyinputedges (this=0x7ffffffe8d50, idx2verlist=0x5555565af140) at tetgen.cxx:14283
14283 if (endpts[0] == endpts[1]) {
+bt
#0 0x00007ffff6b3e75a in tetgenmesh::identifyinputedges (this=0x7ffffffe8d50, idx2verlist=0x5555565af140) at tetgen.cxx:14283
#1 0x00007ffff6b40238 in tetgenmesh::meshsurface (this=0x7ffffffe8d50) at tetgen.cxx:14686
#2 0x00007ffff6b998bc in tetrahedralize (b=0x7fffffff9f10, in=0x7fffffffba30, out=0x7fffffffbbf0, addin=0x0, bgmin=0x0) at tetgen.cxx:36166
#3 0x00007ffff6b9ab3d in tetrahedralize (switches=0x7fffffffbdc0 "pqezQ", in=0x7fffffffba30, out=0x7fffffffbbf0, addin=0x0, bgmin=0x0) at tetgen.cxx:36559
#4 0x00007ffff41430b8 in DMPlexGenerate_Tetgen (boundary=0x5555564cce40, interpolate=PETSC_TRUE, dm=0x7fffffffd378) at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/generators/tetgen/tetgenerate.cxx:142
#5 0x00007ffff4cf7f28 in DMPlexGenerate (boundary=0x5555564cce40, name=0x7fffffffc2e0 "tetgen", interpolate=PETSC_TRUE, mesh=0x7fffffffd378) at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexgenerate.c:185
#6 0x00007ffff4856e65 in DMPlexCreateBoxMesh_Simplex_Internal (dm=0x5555564b8470, dim=3, faces=0x555556075490, lower=0x7fffffffd5d0, upper=0x7fffffffd5f0, periodicity=0x7fffffffd5c4, interpolate=PETSC_TRUE) at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:825
#7 0x00007ffff48622ff in DMPlexCreateBoxMesh_Internal (dm=0x5555564b8470, dim=3, simplex=PETSC_TRUE, faces=0x555556075490, lower=0x7fffffffd5d0, upper=0x7fffffffd5f0, periodicity=0x7fffffffd5c4, interpolate=PETSC_TRUE) at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:1293
#8 0x00007ffff4862e28 in DMPlexCreateBoxMesh (comm=1140850688, dim=3, simplex=PETSC_TRUE, faces=0x555556075490, lower=0x7fffffffd5d0, upper=0x7fffffffd5f0, periodicity=0x7fffffffd5c4, interpolate=PETSC_TRUE, dm=0x7fffffffd588) at /home/yzz/firedrake/real-int32-mkl-debug/src/petsc/src/dm/impls/plex/plexcreate.c:1379
#9 0x00007ffff761ee2d in __pyx_pf_8petsc4py_5PETSc_6DMPlex_4createBoxMesh (__pyx_v_self=0x7fff42fd7290, __pyx_v_faces=0x7fff43713f90, __pyx_v_lower=0x7ffff78ff6c0, __pyx_v_upper=0x7ffff78ff700, __pyx_v_simplex=0x555555ac3420 <_Py_TrueStruct>, __pyx_v_periodic=0x555555ac3400 <_Py_FalseStruct>, __pyx_v_interpolate=0x555555ac3420 <_Py_TrueStruct>, __pyx_v_comm=0x555555ace3e0 <_Py_NoneStruct>) at src/petsc4py.PETSc.c:305304
#10 0x00007ffff761e6cc in __pyx_pw_8petsc4py_5PETSc_6DMPlex_5createBoxMesh (__pyx_v_self=0x7fff42fd7290, __pyx_args=0x7fff437623e0, __pyx_kwds=0x7fff43933d00) at src/petsc4py.PETSc.c:305097
#11 0x00005555556afb5e in cfunction_call (func=0x7fff42fd72e0, args=<optimized out>, kwargs=<optimized out>) at ../Objects/methodobject.c:543
#12 0x00005555556a67db in _PyObject_MakeTpCall (tstate=0x555555b5eb20, callable=0x7fff42fd72e0, args=<optimized out>, nargs=<optimized out>, keywords=0x7ffff79ff760) at ../Objects/call.c:215
#13 0x000055555569fe1c in _PyObject_VectorcallTstate (kwnames=0x7ffff79ff760, nargsf=<optimized out>, args=<optimized out>, callable=0x7fff42fd72e0, tstate=0x555555b5eb20) at ../Include/cpython/abstract.h:112
#14 _PyObject_VectorcallTstate (kwnames=0x7ffff79ff760, nargsf=<optimized out>, args=<optimized out>, callable=0x7fff42fd72e0, tstate=0x555555b5eb20) at ../Include/cpython/abstract.h:99
#15 PyObject_Vectorcall (kwnames=0x7ffff79ff760, nargsf=<optimized out>, args=<optimized out>, callable=0x7fff42fd72e0) at ../Include/cpython/abstract.h:123
#16 call_function (kwnames=0x7ffff79ff760, oparg=<optimized out>, pp_stack=<synthetic pointer>, trace_info=0x7fffffffd8d0, tstate=<optimized out>) at ../Python/ceval.c:5891
#17 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:4231
#18 0x0000555555695766 in _PyEval_EvalFrame (throwflag=0, f=0x7ffff7b25c40, tstate=0x555555b5eb20) at ../Include/internal/pycore_ceval.h:46
#19 _PyEval_Vector (tstate=0x555555b5eb20, con=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=<optimized out>) at ../Python/ceval.c:5065
#20 0x000055555578d456 in PyEval_EvalCode (co=0x7ffff79ea970, globals=0x7ffff79da340, locals=<optimized out>) at ../Python/ceval.c:1134
#21 0x00005555557b9f08 in run_eval_code_obj (tstate=0x555555b5eb20, co=0x7ffff79ea970, globals=0x7ffff79da340, locals=0x7ffff79da340) at ../Python/pythonrun.c:1291
#22 0x00005555557b2d5b in run_mod (mod=<optimized out>, filename=<optimized out>, globals=0x7ffff79da340, locals=0x7ffff79da340, flags=<optimized out>, arena=<optimized out>) at ../Python/pythonrun.c:1312
#23 0x00005555557b9c55 in pyrun_file (fp=fp@entry=0x555555b40370, filename=filename@entry=0x7ffff7878db0, start=start@entry=257, globals=globals@entry=0x7ffff79da340, locals=locals@entry=0x7ffff79da340, closeit=closeit@entry=1, flags=0x7fffffffdb78) at ../Python/pythonrun.c:1208
#24 0x00005555557b9138 in _PyRun_SimpleFileObject (fp=0x555555b40370, filename=0x7ffff7878db0, closeit=1, flags=0x7fffffffdb78) at ../Python/pythonrun.c:456
#25 0x00005555557b8e33 in _PyRun_AnyFileObject (fp=0x555555b40370, filename=0x7ffff7878db0, closeit=1, flags=0x7fffffffdb78) at ../Python/pythonrun.c:90
#26 0x00005555557aa0ae in pymain_run_file_obj (skip_source_first_line=0, filename=0x7ffff7878db0, program_name=0x7ffff79dc500) at ../Modules/main.c:353
#27 pymain_run_file (config=0x555555b42db0) at ../Modules/main.c:372
#28 pymain_run_python (exitcode=0x7fffffffdb74) at ../Modules/main.c:587
#29 Py_RunMain () at ../Modules/main.c:666
#30 0x000055555578034d in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at ../Modules/main.c:720
#31 0x00007ffff7c7cd90 in __libc_start_call_main (main=main@entry=0x555555780310 <main>, argc=argc@entry=8, argv=argv@entry=0x7fffffffdd88) at ../sysdeps/nptl/libc_start_call_main.h:58
#32 0x00007ffff7c7ce40 in __libc_start_main_impl (main=0x555555780310 <main>, argc=8, argv=0x7fffffffdd88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd78) at ../csu/libc-start.c:392
#33 0x0000555555780245 in _start ()
+l
14278 makepoint2submap(subfaces, idx2shlist, shperverlist);
14279
14280 // Process the set of input edges.
14281 for (i = 0; i < in->numberofedges; i++) {
14282 endpts = &(in->edgelist[(i << 1)]);
14283 if (endpts[0] == endpts[1]) {
14284 if (!b->quiet) {
14285 printf("Warning: Edge #%d is degenerated. Skipped.\n", i);
14286 }
14287 continue; // Skip a degenerated edge.
+p endpts
$1 = (int *) 0x0
+set logging enabled off
Additionally, I would like to ask: what is the difference between tetgen
and ctetgen
?