[petsc-users] Initializing a large sparse matrix

Jose E. Roman jroman at dsic.upv.es
Mon Oct 17 02:02:37 CDT 2022


You have to preallocate, see https://petsc.org/release/docs/manual/mat/#sec-matsparse

> El 17 oct 2022, a las 8:37, fujisan <fujisan43 at gmail.com> escribió:
> 
> Hi everyone,
> 
> I initialize a large sparse matrix (50000x20000) using MatCreate() and then filling it with MatSetValues() line by line 
> but it takes a bit more than an hour on 80 cores to fill in the matrix.
> 
> Is there a way to optimize this initialization?
> 
> Fuji



More information about the petsc-users mailing list