BUG: Loading a Gmsh mesh with a $Periodic section hangs or aborts under MPI, depending on the rank count (works on 1–2, hangs on 3–5, MPI_ERR_BUFFER on 6)

Aperta
#5,371 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia con il riproduttore allegato bug_periodic_parallel.py ed eseguilo su 1–6 rank MPI per confermare il comportamento dipendente dal rank. Traccia in Firedrake il codice di mesh.py intorno a make_mesh_from_mesh_topology() alle righe 3211 e 3427, quindi esamina il fallimento di DMGetCoordinatesLocalized() segnalato da PETSc. Il lavoro è completato quando le mesh periodiche vengono caricate in modo affidabile per il numero di rank testati oppure generano un errore chiaro a livello Python invece di bloccarsi o terminare con un abort.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

bug_periodic_parallel.py

Summary

fd.Mesh() on a Gmsh MSH 4.1 file containing a $Periodic section behaves correctly on 1
and 2 MPI ranks, but hangs indefinitely on 3, 4 and 5 ranks, and fails on 6 with
MPI_ERR_BUFFER raised from DMGetCoordinatesLocalized(). The same mesh without the
$Periodic section distributes correctly on every rank count tested.

The silent hang is the more troubling symptom: there is no error, no traceback and no exit,
so a job simply stalls with no indication of why.

Environment
Image firedrakeproject/firedrake-vanilla-complex:dev-release (pulled 2026-08-10)
Firedrake 2026.4.2.dev0
PETSc / petsc4py 3.25.0 (release), int32
mpi4py 4.1.2
fenics-ufl / firedrake-fiat 2025.3.0 / 2026.4.0
numpy / gmsh 2.5.1 / 4.15.2
Scalar type complex128
MPI Open MPI (version below)
Host Docker on Windows/WSL2, 6 cores × 2 threads

Also reproduced on the preceding release image (:latest, firedrake 2026.4.1, same PETSc
3.25.0, mpi4py 4.1.1): 1 and 2 ranks work, 6 ranks aborts, identically. So this is not a
regression introduced by the recent dev commits — both the current release and the
development build are affected.

Reproducer

bug_periodic_parallel.py (attached below) builds a 4 × 1 rectangle with the left and right
edges identified by translation — 150 nodes, 298 elements, no dependencies beyond Firedrake
and gmsh.

for n in 1 2 3 4 5 6; do
    echo "=== -n $n ==="
    timeout 120 mpiexec -n $n python3 bug_periodic_parallel.py
    echo "    exit=$?   (124 = timed out => hang)"
done
Observed
ranks result
1 ✅ correct
2 ✅ correct
3 ⛔ hangs — no output, no exit, killed by timeout
4 ⛔ hangs
5 ⛔ hangs
6 ❌ MPI_ERR_BUFFER (has also been observed to hang)

Non-periodic meshes of the same geometry distribute correctly at all of these rank counts, so
the partitioning itself is fine — it is specific to the periodic identification.

Traceback (6 ranks)
  File "/opt/firedrake/firedrake/mesh.py", line 3427, in Mesh
    mesh = make_mesh_from_mesh_topology(topology, name)
  File "/opt/firedrake/firedrake/mesh.py", line 3211, in make_mesh_from_mesh_topology
    if not dm.getCoordinatesLocalized():
  File "petsc4py/PETSc/DM.pyx", line 1345, in petsc4py.PETSc.DM.getCoordinatesLocalized
petsc4py.PETSc.Error: error code 98
[5] DMGetCoordinatesLocalized() at /opt/petsc/src/dm/interface/dmperiodicity.c:275
[5] General MPI error
[5] MPI error 1 MPI_ERR_BUFFER: invalid buffer pointer
Expected

Either the periodic mesh distributes at any rank count, or — if this is a known unsupported
configuration — fd.Mesh() raises a clear Python-level error. The current behaviour on 3–5
ranks gives the caller nothing to act on: because the failure is a deadlock (and, at 6 ranks,
an MPI_ABORT), it cannot be caught with try/except, so it is not possible to detect the
limitation from user code and fall back.

Note on rank-count dependence

The pass/fail pattern is not monotone in an obvious way — 2 works while 3, 4, 5 and 6 do not
— which suggests the trigger is how the periodic seam lands relative to partition boundaries
rather than the rank count as such. On 2 ranks a straight-line partition of this geometry can
leave the seam owned by a single rank; above that it is necessarily split.

Lingua principale
Python
Stelle
684
Fork
204
Merge medio
4g 14h
PR unite (30g)
46

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firedrakeproject/firedrake

Tutte le issue di firedrakeproject/firedrake

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.