[Trilinos-Users] Questions about InsertGlobalValues

Williams, Alan B william at sandia.gov
Fri Aug 27 08:20:37 MDT 2010


Scot,

There is a subtle behavior issue with filling matrices. When you use InsertGlobalValues, it appends incoming entries to the row, regardless of whether those indices already exist in that row. So in some scenarios that can use a lot of extra memory.
An alternative approach is to first build up the graph (Epetra_CrsGraph), call fillComplete on it, then create your matrix with the graph and use SumIntoGlobalValues instead of InsertGlobalValues.

Not sure if that's the issue you're hitting here, but it's worth keeping in mind.
Alan

> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
> users-bounces at software.sandia.gov] On Behalf Of M. Scot Breitenfeld
> Sent: Thursday, August 26, 2010 12:51 PM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] Questions about InsertGlobalValues
> 
>   I have a few questions about the use of InsertGlobalValues for
> Epetra_FECrsMatrix class matrix, which is for my K matrix. Currently I
> form one row and then use the InsertGlobalValues routine to add it to K
> (I'm forming the row array in a Fortran program). Is it better (faster)
> to form more rows and then send that to InsertGlobalValues, or does it
> not matter.
> 
> Also, I'm getting an error in Epetra_CrsGraph.cpp:
> 
> Epetra_CrsGraph::InsertIndices(int Row,
>                     int NumIndices,
>                     int* UserIndices)
> 
> by  failing
>      if(current_numAllocIndices == 0) {
>      int * temp = new int[NumIndices];
>      CrsGraphData_->Indices_[Row] = temp;
>        }
>        else {
>      ierr = 3; // Out of room.  Must allocate more space, copy and
> delete...
> 
> and getting ierr = 3. Is there something I'm doing wrong to get this
> error?
> 
> I'm trying to track down a memory problem where it is taking more
> memory
> to store K then it would to just storing the full matrix with all the
> zero coefficients. I've tracked it down to the InsertGlobalValues but I
> have not found the source of the problem. This happens regardless if I
> run it in serial or parallel. It also takes an extremely long time to
> assemble the matrix (it takes longer then solving the system of
> equations), but I suspect it is related to the memory problems.
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users



More information about the Trilinos-Users mailing list