test_dof_to_vertex_map fails in MPI with PETSc 3.19: VecAXPY PETSc error 73 "wrong state"
Issue #1140
new
test_dof_to_vertex_map
in python/test/unit/fem/test_dofmap.py
fails when run in MPI after building with PETSc 3.19.6
$mpirun -n 3 pytest-3 -vs test_dofmap.py -k dof_to_vertex_map
...
______________________ test_dof_to_vertex_map[True-mesh_factory0] ____________________________
u1.vector().set_local(vert_values[dof_to_vertex_map(Q)[:dim]].copy())
> assert round((u0.vector()-u1.vector()).sum() - 0.0, 7) == 0
E RuntimeError:
E
E *** -------------------------------------------------------------------------
E *** DOLFIN encountered an error. If you are not able to resolve this issue
E *** using the information listed below, you can ask for help at
E ***
E *** fenics-support@googlegroups.com
E ***
E *** Remember to include the error message listed below and, if possible,
E *** include a *minimal* running example to reproduce the error.
E ***
E *** -------------------------------------------------------------------------
E *** Error: Unable to successfully call PETSc function 'VecAXPY'.
E *** Reason: PETSc error code is: 73 (Object is in wrong state).
E *** Where: This error was encountered inside ./dolfin/la/PETScVector.cpp.
E *** Process: 2
E ***
E *** DOLFIN version: 2019.2.0.13.dev0
E *** Git changeset: debian_2019.2.0~legacy20230609.8b85e9d.ar-6
E *** -------------------------------------------------------------------------
test_dofmap.py:288: RuntimeError
Full log e.g. at https://ci.debian.net/data/autopkgtest/unstable/arm64/d/dolfin/41474196/log.gz
The key problem seems to be “wrong state”. The data itself has been assigned correctly. That is, using the data directly (as numpy arrays) by replacing l.283
assert round((u0.vector()-u1.vector()).sum() - 0.0, 7) == 0
with
assert round((u0.vector()[:]-u1.vector()[:]).sum() - 0.0, 7) == 0
does pass.
For more context, dof_to_vertex_map
was deprecated in dolfinx and removed in https://github.com/FEniCS/dolfinx/pull/90
There are some other issues with later PETSc and legacy DOLFIN as well.
PETSc >=3.20 breaks the PETScDMCollection in the tests.