Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-27 Thread Kong, Fande
Hi Barry, Just added a PR for this. https://bitbucket.org/petsc/petsc/pull-requests/760/matresetpreallocation/diff Fande, On Mon, Sep 25, 2017 at 12:35 PM, Kong, Fande wrote: > > > On Mon, Sep 25, 2017 at 12:26 PM, Barry Smith wrote: > >> >> > On Sep 25, 2017, at 1:17 PM, Kong, Fande wrote:

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Kong, Fande
On Mon, Sep 25, 2017 at 12:26 PM, Barry Smith wrote: > > > On Sep 25, 2017, at 1:17 PM, Kong, Fande wrote: > > > > > > > > On Mon, Sep 25, 2017 at 11:41 AM, Barry Smith > wrote: > > > > > On Sep 25, 2017, at 11:22 AM, Kong, Fande wrote: > > > > > > > > > > > > On Mon, Sep 25, 2017 at 10:05 AM,

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Barry Smith
> On Sep 25, 2017, at 1:17 PM, Kong, Fande wrote: > > > > On Mon, Sep 25, 2017 at 11:41 AM, Barry Smith wrote: > > > On Sep 25, 2017, at 11:22 AM, Kong, Fande wrote: > > > > > > > > On Mon, Sep 25, 2017 at 10:05 AM, Stefano Zampini > > wrote: > > If you know the union of the different spa

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Kong, Fande
On Mon, Sep 25, 2017 at 11:41 AM, Barry Smith wrote: > > > On Sep 25, 2017, at 11:22 AM, Kong, Fande wrote: > > > > > > > > On Mon, Sep 25, 2017 at 10:05 AM, Stefano Zampini < > stefano.zamp...@gmail.com> wrote: > > If you know the union of the different sparsity patterns, after you > preallocat

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Barry Smith
> On Sep 25, 2017, at 11:22 AM, Kong, Fande wrote: > > > > On Mon, Sep 25, 2017 at 10:05 AM, Stefano Zampini > wrote: > 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 n

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Kong, Fande
On Mon, Sep 25, 2017 at 10:05 AM, Stefano Zampini wrote: > 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. > > Thanks, Stefano, Yes, we

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Stefano Zampini
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" ha scritto: > Hi Matt, > > Thanks for your reply. > >

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Kong, Fande
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

Re: [petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Matthew Knepley
On Mon, Sep 25, 2017 at 11:39 AM, Kong, Fande 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

[petsc-dev] MatAssembly removes all preallocation info

2017-09-25 Thread Kong, Fande
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