Using more than one MPI ranks and IdentificationType.PERIODIC, causes a segmentation fault.
Environment
- OS: 6.8.0-124-generic-x86_64-with-glibc2.39
- System: Linux 6.8.0-124-generic
- Machine: x86_64
- Python: 3.12.11 (main, Jun 20 2025, 20:06:26) [GCC 9.5.0]
- mpi4py: 4.1.2
- NGSolve: 6.2.2605
- Netgen: 6.2.2604.post38.dev0
- MPI: Open MPI 4.1.6
Minimal script:
#!/usr/bin/env ngspy
from mpi4py import MPI
from ngsolve import Mesh
from netgen.occ import Box, Pnt, OCCGeometry, IdentificationType
comm = MPI.COMM_WORLD
rank = comm.rank
box = Box(Pnt(-1, -1, -1), Pnt(1, 1, 1))
# Problematic line (works without it)
box.faces[5].Identify(box.faces[4], "top", IdentificationType.PERIODIC)
print(f"Rank {rank}: before GenerateMesh", flush=True)
occgeom = OCCGeometry(box).GenerateMesh(
maxh=0.2,
comm=comm,
)
print("after geometry") # This line is never reached
mesh = Mesh(occgeom)
print("after mesh")
print(f"Rank {rank}: success", flush=True)
Output:
$ mpirun -n 2 ngspy test-ngsolve.py
Rank 0: before GenerateMesh
Rank 1: before GenerateMesh
[thinkpad:1858025] *** Process received signal ***
[thinkpad:1858025] Signal: Segmentation fault (11)
[thinkpad:1858025] Signal code: Address not mapped (1)
[thinkpad:1858025] Failing at address: (nil)
[thinkpad:1858025] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x71c4c9c45330]
[thinkpad:1858025] [ 1] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x11190f4)[0x71c4b25190f4]
[thinkpad:1858025] [ 2] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x111edc0)[0x71c4b251edc0]
[thinkpad:1858025] [ 3] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(_ZN6netgen4Mesh10DistributeEv+0x94)[0x71c4b251ee84]
[thinkpad:1858025] [ 4] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x12b589d)[0x71c4b26b589d]
[thinkpad:1858025] [ 5] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x12b6497)[0x71c4b26b6497]
[thinkpad:1858025] [ 6] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x12bd746)[0x71c4b26bd746]
[thinkpad:1858025] [ 7] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x12be09a)[0x71c4b26be09a]
[thinkpad:1858025] [ 8] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0x12b6a7b)[0x71c4b26b6a7b]
[thinkpad:1858025] [ 9] ~/experiments/.venv/lib/python3.12/site-packages/netgen/../../../libnglib.so(+0xec584e)[0x71c4b22c584e]
[thinkpad:1858025] [10] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(+0x1cf9a1)[0x71c4ca1cf9a1]
[thinkpad:1858025] [11] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(PyObject_Vectorcall+0x55)[0x71c4ca173d55]
[thinkpad:1858025] [12] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(_PyEval_EvalFrameDefault+0x48a5)[0x71c4ca1118c5]
[thinkpad:1858025] [13] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(PyEval_EvalCode+0x225)[0x71c4ca294fd5]
[thinkpad:1858025] [14] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(+0x2f14ad)[0x71c4ca2f14ad]
[thinkpad:1858025] [15] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(+0x2f15b5)[0x71c4ca2f15b5]
[thinkpad:1858025] [16] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(_PyRun_SimpleFileObject+0x17a)[0x71c4ca2f476a]
[thinkpad:1858025] [17] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(_PyRun_AnyFileObject+0x3f)[0x71c4ca2f4daf]
[thinkpad:1858025] [18] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(+0x31d834)[0x71c4ca31d834]
[thinkpad:1858025] [19] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(Py_RunMain+0x2a)[0x71c4ca31dbea]
[thinkpad:1858025] [20] ~/.pyenv/versions/3.12.11/lib/libpython3.12.so.1.0(Py_BytesMain+0x5a)[0x71c4ca31dd9a]
[thinkpad:1858025] [21] /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x71c4c9c2a1ca]
[thinkpad:1858025] [22] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x71c4c9c2a28b]
[thinkpad:1858025] [23] ~/experiments/.venv/bin/python(_start+0x25)[0x62ca85a44095]
[thinkpad:1858025] *** End of error message ***
~/experiments/.venv/bin/ngspy: line 2: 1858025 Segmentation fault (core dumped) LD_PRELOAD=$LD_PRELOAD: ~/experiments/.venv/bin/python $*
--------------------------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[9278,1],0]
Exit code: 139
--------------------------------------------------------------------------
Using more than one MPI ranks and
IdentificationType.PERIODIC, causes a segmentation fault.Environment
Minimal script:
Output: