PETScVector::init should not take comm as an argument

Issue #789 resolved
Jan Blechta created an issue

This fails on two processes:

from dolfin import*
vec = PETScVector()
vec.init(mpi_comm_self(), 1)
assert vec.mpi_comm() == mpi_comm_self()

As a result PETScVector::gather which uses init() does not work properly. See, https://groups.google.com/forum/#!topic/fenics-support/C3uIwxMGhws, thanks Giorgos Grekas for reporting.

Moreoever the condition on y.mpi_comm() here looks incorrect.

Comments (12)

  1. Prof Garth Wells

    The bug is that PETSc::init shouldn't take a communicator. The underlying PETSc object is created in the constructor, and this is when the communicator is set.

    Use in the report is incorrect. Correct usage is:

    from dolfin import *
    
    # create  communicator
    
    vec = PETScVector(comm)
    vec.init(mpi_comm_self(), 1)  # PETSc::init should be fixed to not require a communicator
    assert vec.mpi_comm() == mpi_comm_self()
    
  2. Prof Garth Wells

    I confess that it wasn't exactly forgotten. I don't have Trilinos installed, and the wrappers are in too poor shape for me to have had a go blind.

    We need to have test coverage for the Trilinos backend, or remove it. @chris_richardson ?

  3. Log in to comment