> Looking into where vec_distribute is used, it only in the method
> "ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec)
> const". The method first seems to run a setup procedure on the
> vec_distribute, which is presumably expensive otherwise vec_distribute
> could be local to the class. Avoiding calling the default constructor
> on vec_distribute seems to difficult in ConstraintMatrix and on the
> other hand it doesn't seem in appropriate for ConstraintMatrix to call
> the default constructor if MPI isn't used, since the object produced
> by the default constructor is not intended to be used without a reinit
> call anyway.
>
> I am attaching some code with modifications to test MPI_Initialized
> before calling Epetra_MpiComm and if the test is false, to divert the
> Epetra_Maps to use Epetra_SerialComm.

I'm not too fond of this option. How about doing the following: in the 
ConstraintMatrix make the vec_distribute member a pointer to 
TrilinosWrappers::VectorBase, and in the constructor of that class you 
check whether MPI_Init was called -- if so, you do
  vec_distribute = new TrilinosWrappers::MPI::Vector(...)
otherwise
  vec_distribute = new TrilinosWrappers::Vector

Would that work? It would also be a far more localized patch. It'd be great 
if you could give this a try!


> I also expect that users who make Trilinos:MPI:Vectors before
> MPI_Init is run might see some strange errors, on the other hand the
> reinit method may avoid this.

Yes. Though I think that using MPI::Vector should be allowed, even if we 
aren't using MPI, as long as you only ever use MPI_COMM_WORLD. I believe 
at least that step-17, step-18, and step-32 should also work on single 
processor machines if linked with PETSc or Trilinos libraries compiled 
with --without-mpi.

Best
 Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [email protected]
                                 www: http://www.math.tamu.edu/~bangerth/

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to