[petsc-users] choosing MatSetValue or MatSetValues

John-Michael Fischer fischej at umich.edu
Thu Mar 11 10:34:31 CST 2010


I need some help in determining the extent of the benefit when doing dense matrix insertions.

Essentially, in our software we need every last byte of memory we can get, and I wanted to get some feedback on how much slower it would be when building a dense matrix to use different insertion methods.
Option A: 
Use MatSetValue for every datapoint.
Option B: 
Store some amount of values locally in an array as they are generated (which would take up extra memory), say 1024, then using MatSetValues to insert them over several sweeps of local generation.

If the speed tradeoff for building the matrix is say, a factor of 2, in exchange for not having to allocate the extra local memory -- then its probably worth it for us.  I just wanted to get some intelligent comment on what those tradeoffs might be and how they would scale.

Thanks
John-Michael Fischer


More information about the petsc-users mailing list