You need to set the preallocation for the matrix. https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html
On Thu, May 2, 2019 at 7:46 AM Dongyu Liu via petsc-users < [email protected]> wrote: > Hi, > > I am using PETSc sparse matrix ('aij') for a FEM program, when the > matrix is really big, let's say 1million by 1million, we use setValues > based on the index vector I and J, but the whole process takes around 2 > hours. > > I don't know why it is like that, or is there any option that I should > set to make this faster? > > > Best, > > Dongyu > >
