This is what I'd expect to observe if you didn't preallocate correctly for the second matrix, which has more nonzeros per row.
https://petsc.org/release/docs/manual/mat/#sec-matsparse 김성익 <ksi2...@gmail.com> writes: > Hello, > > > > I have a question about memory of matsetvalue. > > When I assembly the local matrix to global matrix, I’m just using > matsetvalue. > Because the connectivity is so complex I can’t use matsetvalues. > > I asked this question because I was curious about how ram memory is > allocated differently for the two simtuations below. > > > > First situation. > > The local matrix size is 24 by 24. And the number of local matrix is > 125,000. > > When assembly procedure by using matsetvalue, memory allocation does not > increase. > So I just put Matassemblybegin and matassemblyend after all matsetvalue. > > > > Second situation. > > The local matrix size is 60 by 60. And the number of local matrix is 27,000. > > When assembly procedure by using matsetvalue, memory allocation does > increase. > > So I just put Matassemblybegin and matassemblyend after each local matrix > assembly. > This did not increase the memory further.. > > > > Why this situation is happen? > > And is there any way to prevent the memory allocation from increasing? > > > > > > > > Thanks, > > Hyung Kim