[Trilinos-Users] Questions about InsertGlobalValues

M. Scot Breitenfeld brtnfld at uiuc.edu
Wed Sep 8 10:11:15 MDT 2010

  On 08/27/2010 09:20 AM, Williams, Alan B wrote:
> 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.
This is probably what is happening.

When making a graph I'm assuming I need to use Epetra_FECrsGraph since I 
have off-processor row assignments.
If I don't give the column map and instead give the maximum 
NumIndicesPerRow as in:

Epetra_FECrsGraph::Epetra_FECrsGraph 	( 	Epetra_DataAccess 

	const Epetra_BlockMap 
& 	/RowMap/,

	int 	/NumIndicesPerRow/,

	bool 	/ignoreNonLocalEntries/ = |false| 	


then how do I go about actually generating the graph since in 
InsertGlobalIndices  column mapping is an input?

I would like to avoid creating column mapping because it changes as I 
iterate and would have to be updated for every iteration.

> 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