[petsc-users] [Ext] change matrix
Kun Jiao
KJiao at slb.com
Mon Aug 31 14:36:37 CDT 2020
thanks for the info.
regards,
kun
On Aug 31, 2020 2:20 PM, Matthew Knepley <knepley at gmail.com> wrote:
On Mon, Aug 31, 2020 at 3:12 PM Barry Smith <bsmith at petsc.dev<mailto:bsmith at petsc.dev>> wrote:
On Aug 31, 2020, at 2:08 PM, Kun Jiao <KJiao at slb.com<mailto:KJiao at slb.com>> wrote:
If I am correct, to do this, it will double the peak memory usage.
Yes
Is there any way no to double the peak memory usage?
The only way would be to destroy the old matrix, allocate a new one and recompute the entries.
Barry
Depending on the application etc the extra memory for storing two copies of the matrix may not be a fundamental problem
The other thing is to look at why you are adding rows. If you know how many will eventually show up you can allocate them, but fill
with zeros, etc. until you get the values.
Thanks,
Matt
Schlumberger-Private
From: Barry Smith <bsmith at petsc.dev<mailto:bsmith at petsc.dev>>
Sent: Monday, August 31, 2020 1:56 PM
To: Kun Jiao <KJiao at slb.com<mailto:KJiao at slb.com>>
Cc: petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [Ext] Re: [petsc-users] change matrix
Kun,
This is not possible, PETSc matrices have a static size (resizing in parallel is tricky so we don't support it).
If it is more efficient to reuse the matrix entries than recompute them you can create a larger matrix and then loop over the old matrix calling MatGetRow() and then call MatSetValues() to copy that row into the new matrix.
Barry
On Aug 31, 2020, at 1:51 PM, Kun Jiao via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
Hi Petsc Experts,
Trying to do something like appending some rows (~100 rows) to an already created matrix, but could not find any document about it.
Could anyone provide some information about it?
Regards,
Kun
Schlumberger-Private
--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/<https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!Kjv0uj3L4nM6H-I!1DsOzqE1FW189HX-Sf5RdMH_Xn_54Njs61iBLPQPM1_zafyhfPLOB8cdOlY$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200831/a23e313d/attachment.html>
More information about the petsc-users
mailing list