SV: SV: Slow MatSetValues
Lars Rindorf
Lars.Rindorf at teknologisk.dk
Mon Jun 2 03:31:37 CDT 2008
Calling MatMPIAIJSetPreallocation again after MatSetFromOptions fixed the problem! Thanks.
KR, Lars
-----Oprindelig meddelelse-----
Fra: owner-petsc-users at mcs.anl.gov [mailto:owner-petsc-users at mcs.anl.gov] På vegne af Jed Brown
Sendt: 30. maj 2008 14:31
Til: petsc-users at mcs.anl.gov
Emne: Re: SV: Slow MatSetValues
On Fri 2008-05-30 13:44, Lars Rindorf wrote:
> Hi everybody
>
> Thanks for all the suggestions and help. The problem is of a bit different nature. I use only direct solvers, so I give the options "-ksp_type preonly -pc_type lu" to make a standard LU factorization. This works fine without any problems. If I additionally set "-mat_type umfpack" to use umfpack then MatSetValues is very, very slow (about 50 times slower). If, as a test, I call MatAssemblyBegin and MatAssemblyEnd before MatSetValues, and only use the lu (no umfpack) then the performance is very similarly slow.
I've seen this problem when preallocation information is lost by changing the matrix type. Try putting MatSeqAIJSetPreallocation() and/or (it doesn't hurt to do both) MatMPIAIJSetPreallocation() after MatSetFromOptions(). This will preallocate for any matrix type that inherits from these two types (which I think is anything you might use).
Jed
More information about the petsc-users
mailing list