[Trilinos-Users] ForTrilinos: Problems with Epetra_Vector

Dominic Kedelty dkedelty at asu.edu
Mon Nov 30 15:47:40 EST 2015


I am having a problem with Epetra_Vectors inside of  ForTrilinos. Currently
I have a parallel CFD code set up that constructs a CRS sparse A matrix and
a B vector for the discretization that I am dealing with. What I would like
to do is have a subroutine that I pass in the row_pointer for a A, column
indices for A, and the B vector and get an X vector as an output.
Initially, what I wanted to do was have A_ B_ and X_ be epetra_crsmatrix
and epetra_vectors that are defined within the scope of a subroutine.

subroutine solve_problem( rowptr_A, colidx_A, values_A, values_B, values_X )
  type(Epetra_MpiComm) :: comm
  type(Epetra_Map) :: map
  type(Epetra_CrsMatrix) :: A_
  type(Epetra_Vector) :: X_,B_
  type(AztecOO) :: Solver

  comm = Epetra_MpiComm(MPI_COMM_WORLD)

  map = Epetra_Map(-1_c_int,MyGlobalCVs,1_c_int,comm)

  A_ = Epetra_CrsMatrix(FT_Epetra_DataAccess_E_Copy,map,NumNonZero)

  [... Fill A ...]

  B_=Epetra_Vector(map,.true.)
  X_=Epetra_Vector(map,.true.)

  [... solve here ...]

  call Solver%force_finalize
  call X_%force_finalize()
  call B_%force_finalize()
  call A_%force_finalize()
  call map%force_finalize()
  call comm%force_finalize()

end subroutine

When I coded this approach, it worked for my first timestep (I verified the
values_X solution and it was correct)... But, for whatever reason, when the
subroutine is called a second time I get random errors (mostly SIGSEGV).
After some debugging, I have found that the problem lies when I call
B_=Epetra_Vector(map,.true.) or any Epetra_Vector for that matter. The
problem does not happen during the call however, it happens when I leave
the subroutine.

I've read that the force_finalize calls are only needed with certain
compilers, is this true? and do I need to call force_finalize. Second, I am
using an arbitrary map for CVs that I have partitioned across multiple
processors. Am I doing anything wrong with how I am declaring my map, or
how I am using it? And is there any information that would be useful in
figuring out why I am having issues with the Epetra Vectors. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20151130/9093e9d4/attachment.html>


More information about the Trilinos-Users mailing list