[petsc-users] Slepc Matrix memory preallocation

Michael R Nowak nowakmr at umich.edu
Thu Jul 12 16:14:04 CDT 2012


Hello,

I'm setting up a matrix with Slepc, and manually setting the preallocation
for nonzero entries row-by-row using the MatMPISBAIJSetPreallocation
function as follows:

MatMPISBAIJSetPreallocation(LaplaceOperator,
                            1,
                            0,
                            nonzeroEntries,
                            0,
                            PETSC_NULL);

The problem with this is that the number of nonzero entries per row that I
give Slepc is not the same as the number of nonzero entries that Slepc
allocates space for, slepc always seems to allocate N more nonzeroes than
needed, with N being the number of rows in the matrix. This is a problem
for me, since I would like to reduce the number of unneeded nonzero entries
to exactly zero, in order to save memory. The number of nonzero entries
that I give in nonzeroEntries is exactly what is used, so why are extra
nonzeroes being allocated? Any help with this would be much appreciated.

Thanks,

Mike Nowak



More information about the petsc-users mailing list