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
Eehh, i mean 100*10*sizeof(double). matt 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
On Tue, Sep 29, 2009 at 5:32 PM, Matt Funk <[email protected]> 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)?
100*10
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
Not sure what caching you mean. No extra memory will be needed. Do you mean storing values set for off-process rows? We refer to that as "stashing". You can clear the stash by calling MatAssemblyEnd() with ASSEMBLY_FLUSH. Matt
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
-- 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
participants (2)
-
Matt Funk -
Matthew Knepley