DofMap::set and DofMap::set_x fails on non-ghosted vector
Following code
from dolfin import *
mesh = UnitSquareMesh(30, 30)
V = FunctionSpace(mesh, 'CG', 1)
# Make vector with and without ghosts
xg = Function(V).vector()
x = Vector()
x.init(mpi_comm_world(), V.dofmap().ownership_range())
# Check that range is the same
assert xg.local_range() == x.local_range()
# Test DofMap::set,set_x
V.dofmap().set(xg, 1.0)
V.dofmap().set_x(xg, 1.0, 0, mesh)
V.dofmap().set(x, 1.0) # fail
V.dofmap().set_x(x, 1.0, 0, mesh) # fail
fails and investigation shows that DofMap::set
and Dof::set_x
try to set also non-owned DOFs which is refused by PETSc for vector without ghost.
Possible resolutions:
-
WONTFIX because non-ghosted vector has no connection to DofMap so that nobody can guarantee that DofMap functions will work on it.
-
Little bit disturbing is that there is a lot of setting of non-owned DOFs. Not sure what happens behind the scene in PETSc but at least DOLFIN is trying to do a lot of non-local assignments where not necessary. Isn't it also the case in more critical DOLFIN routines?
Comments (2)
-
reporter -
reporter - changed status to invalid
-
It is not logical to use DofMap functions to vector which has no connection to DofMap.
-
Setting ghost values is really without communication.
DofMap::set
communicates just with finalapply("insert")
.DofMap::set_x
does not communicate as it does not callapply("insert")
.
- Log in to comment
When thinking about it, these assignments to non-owned indices are probably just local assignments to ghost without MPI communication. So no danger at all.
@garth-wells Can you confirm it so that it can be closed as INVALID?