Assembling large sparse matrices takes a long time. What can I do make this process faster?
See the Performance chapter of the users manual for many tips on this. a) Preallocate enough space for the sparse matrix. For example, rather than calling MatCreateSeqAIJ(comm,n,n,0,PETSC_NULL,&mat); call MatCreateSeqAIJ(comm,n,n,rowmax,PETSC_NULL,&mat); where rowmax is the maximum number of nonzeros expected per row. Or if you know the number of nonzeros per row, you can pass this information in instead of the PETSC_NULL argument. See the manual pages for each of the MatCreateXXX() routines. b) Insert blocks of values into the matrix, rather than individual components.
Related Questions
- I have a large user interface and it takes along time to read it into BX. Is there any way to speed this process up?
- What is CIC doing to reduce the length of time it takes to process applications at Canadian visa offices?
- Assembling large sparse matrices takes a long time. What can I do make this process faster?