[petsc-users] About matrix assembly

김성익 ksi2443 at gmail.com
Mon Dec 5 05:47:59 CST 2022


Hello,

In matrix preallocation procedure, I tried 2 options to preallocate global
matrix.
The first is ‘MatSeqAIJSetPreallocation’ and the second is
‘MatSetPreallocationCOO’.



When I adopt the first option “MatSeqAIJSetPreallocation(Mat, nz, nnz)”, I
just put overestimated nz for getting enough memory space and also getting
nice performance.

However, It couldn’t run without “MatSetOption(Mat,
MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);” And also, there are no speed
up compare with no preallocation case.



When in the second option “MatSetPreallocationCOO(Mat,ncoo,coo_i,coo_j)”, I
put correct size parameters(ncoo, coo_i, coo_j). However, It couldn’t run
without “MatSetOption(Mat, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);”
Regarding this problem, I suspect that it is a problem caused by mapping a
small-sized local matrix with a different order from the order of coo_i and
coo_j to the global matrix by using “matsetvalue”. And also, there are no
speed up compare with no preallocation case.



1.     How can I do proper preallocation procedure?

2.     Why in my cases there are no speed up?



Thanks,

Hyung Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221205/41c1da81/attachment-0001.html>


More information about the petsc-users mailing list