Hello If we are not doing exact pre-allocation (I know this is despised by PETSc developers) then it seems that we need to specify an nz (per row) value of at least "max nonzeros in any row".
For example with nz=18 I do get 0 mallocs [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5236 X 5236; storage space: 22728 unneeded,71520 used [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0 [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 18 But with nz=16 I get 10 mallocs [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5236 X 5236; storage space: 12406 unneeded,71520 used [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 10 [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 18 So the question is that why is the number of mallocs 10 (with nz=16) when the total storage space has been overestimated (because it says "12406 unneeded")? Or does "unneeded" mean something else? Thanks in advance Tabrez
