[Trilinos-Users] Create new entries after calling FillComplete()

홍광우 yuriprime at kaist.ac.kr
Tue Jun 24 23:07:40 MDT 2014


Thank you Mike Heroux. I'm little confusing about the online documentation.


In the documentation, SumIntoGlobalValues for CrsMatrix is


Add this list of entries to existing values for a given global row of the matrix.


and SumIntoGlobalValues for FECrsMatrix is


.... adding them to any coefficients that may already exist at the specified row/column locations.


Therefore, I think that for CrsMatrix it is prohibited to create new matrix elements when I use SumIntoGlobalValues.


However, for FECrsMatrix, can I create new matrix elements with SumIntoGlobalValues? (The documentation says "may already exist", so I'm confusing.)


Sincerely,


Kwangwoo Hong
 


-----------------------원본메일-----------------------
보낸사람 : "Heroux, Mike" <MHeroux at CSBSJU.EDU>
받는사람: 홍광우<yuriprime at kaist.ac.kr>
보낸날짜: 2014-06-25 13:34:01 GMT +0900 (Asia/Seoul)
제목: Re: [Trilinos-Users] Create new entries after calling FillComplete()

I believe you want to use the SumIntoGlobalValues, but please check the online documentation to make sure.



From: 홍광우 <yuriprime at kaist.ac.kr<mailto:yuriprime at kaist.ac.kr>>

Date: Tuesday, June 24, 2014 9:10 AM

To: Michael Heroux <mheroux at csbsju.edu<mailto:mheroux at csbsju.edu>>

Subject: RE: Re: [Trilinos-Users] Create new entries after calling FillComplete()





Dear Mike Heroux,





I have another question about this mailing list. Now, I'm using FECrsMatrix, and I have a question about inserting new entries.





There are two different functions to insert values, InsertGlobalValues and SumIntoGlobalValues.





I have a question about InsertGlobalValues. I insert new value for a given row i, and column entry j (i,j), and if there already exists matrix element at (i,j), does FECrsMatrix automatically sum values?





For example,



===================================



int NumEntries = 1;



double Value1 = 2.0;





FECrsMatrix.InsertGlobalValues(i, NumEntries, &Value1, &j);





double Value2 = 3.0;





FECrsMatrix.InsertGlobalValues(i, NumEntries, &Value2, &j);



===================================





For the above example, the memory for (i,j) has the value 5.0 (Value1 + Value2) automatically?





Sincerely,





Kwangwoo Hong









Kwangwoo Hong



Ph.D Candidate



Computational Quantum Molecular Science Lab.



Department of Chemistry, KAIST



(Tel) +82-42-350-2855







-----------------------원본메일-----------------------

보낸사람 : "Heroux, Mike" <MHeroux at CSBSJU.EDU<mailto:MHeroux at CSBSJU.EDU>>

받는사람: "yuriprime at kaist.ac.kr<mailto:yuriprime at kaist.ac.kr>" <yuriprime at kaist.ac.kr<mailto:yuriprime at kaist.ac.kr>>

참 조: "trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>" <trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>>

보낸날짜: 2013-09-05 07:53:01 GMT +0900 (Asia/Seoul)

제목: Re: [Trilinos-Users] Create new entries after calling FillComplete()





You should not have to insert values after calling FillComplete. There are more efficient ways to insert values and keep memory costs much lower.



I am guessing from your message you are inserting contributions multiple times for some of your matrix entries. In other words, I am guessing that for a given row i, and column entry j, you are calling InsertGlobalValues multiple times for some or all of the j entries. This behavior happens if you are filling the matrix using a finite element or finite volume discretization and constructing the matrix using local element matrix contributions, or flux contributions across the volume face.



In this case, each separate insertion of the values for j results in a temporary copy of the value. Only when FillComplete is called are the repeated values for each j summed together as a single value. Yes, this is memory expensive, but for users who don't insert multiple contributions, it is faster than trying to merge partial contributions as they come (which is the approach used by Epetra_FECrsMatrix, see next sentence).



If this is the case, probably the best remedy is to use the FECrsMatrix class, which is specifically designed to work with this kind of situation, and sums multiple contribution as they are submitted.



Another approach is to pre-construct the Epetra_CrsGraph associated with your matrix (which also combines entries as they are submitted) and use the Epetra_CrsMatrix constructor that accepts a pre-built graph.



I hope this helps.



Mike



From: 홍광우 <yuriprime at kaist.ac.kr<mailto:yuriprime at kaist.ac.kr><mailto:yuriprime at kaist.ac.kr>>

Date: Monday, September 2, 2013 12:05 AM

To: "trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov><mailto:trilinos-users at software.sandia.gov>" <trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov><mailto:trilinos-users at software.sandia.gov>>

Subject: [Trilinos-Users] Create new entries after calling FillComplete()





Dear developers & users,





I'm using Epetra package, and I have a question about Epetra_CrsMatrix::FillComplete() method.





At the manual, it says that





Note that, even after a matrix is constructed (FillComplete has been called), it is possible to update existing matrix entries. It is not possible to create new entries.





However, I want to create new entires after calling FillComplete(), because it needs too much memory when I just call Epetra_CrsMatrix::InsertGlobalValues() many times. Is there any solution to this problem?





Sincerely,





Kwangwoo





Kwangwoo Hong



Ph.D Candidate



Department of Chemistry, KAIST



+82-42-350-2855















-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20140625/49077751/attachment.html>


More information about the Trilinos-Users mailing list