PETSC memory usage

Matt Funk mafunk at
Tue Sep 29 18:13:11 CDT 2009

i mean 100*10*sizeof(double).


On Tuesday 29 September 2009, Matt Funk wrote:
> Hi,
> i have another question regarding how petsc uses memory w.r.t caching in
> MatSetValues .
> My code does the standard stuff:
> 1) i preallocate the memory
> 2) i insert the values via MatSetValues
> 3)i assemble it.
> Say, for example i declare a 100x100 matrix with 10 NZ entries per row.
> After 1), will the memory used for the matrix be 100^2*10*sizeof(double)?
> After 2), will the memory used be 100^2*10*sizeof(double) from the prealloc
> PLUS 100^2*10*sizeof(double) form the caching of values
> After 3), will the memory then be reduced back to 100^2*10*sizeof(double)?
> My concern is step 2). If it is using memory for prealloc and seperately
> for caching, then is there a way to flush the cached values to the
> preallocated slots? I tried finding stuff in the manual pages but i am not
> quite sure if i can or not.
> thanks
> matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list