[petsc-dev] MatAssembly removes all preallocation info
Stefano Zampini
stefano.zampini at gmail.com
Mon Sep 25 11:05:02 CDT 2017
If you know the union of the different sparsity patterns, after you
preallocate you can set all zeros to use all the entries. This way PETSc
will not complain about new nonzeros in successive assemblies.
Il 25 Set 2017 7:01 PM, "Kong, Fande" <fande.kong at inl.gov> ha scritto:
> Hi Matt,
>
> Thanks for your reply.
>
> The sparsity pattern is slightly different from one Newton iteration to
> another. We preallocate enough memory at the beginning, and want to use
> that memory for the following iterations.
>
> Does PETSc accutally free the preallocated (extra) memory? I so cannot use
> it during the second iteration.
>
>
>
> Fande,
>
> On Mon, Sep 25, 2017 at 9:43 AM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> On Mon, Sep 25, 2017 at 11:39 AM, Kong, Fande <fande.kong at inl.gov> wrote:
>>
>>> Hi All,
>>>
>>> A matrix is created with the right preallocation, and then MatAssembly
>>> is called. The preallocation info will be removed. We insert any values
>>> then, and will encounter an malloc error.
>>>
>>> My question is that we was intending to design like this way? Attached
>>> simple example demonstrates what I am talking about.
>>>
>>
>> Yes, this is the intent. Why are you assembling? Could you use
>> MAT_ASSEMBLY_FLUSH?
>>
>> Matt
>>
>>
>>>
>>> Fande,
>>>
>>
>>
>>
>> --
>> 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.proofpoint.com/v2/url?u=http-3A__www.caam.rice.edu_-7Emk51_&d=DwMFaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=DUUt3SRGI0_JgtNaS3udV68GRkgV4ts7XKfj2opmiCY&m=WrDpQnak7wiz1D4Pyx_jvRGpFKeNDwW2WOH8cIlxrP0&s=7NvRav6CET5Eqpsg7MAiCne1LJ1h2RYKf-OgP6trMkE&e=>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170925/36b43844/attachment.html>
More information about the petsc-dev
mailing list