[petsc-users] Performance of MatSetValues and display the converged tolerance archieved in KSPSolve

NAN ZHAO zhaonanavril at gmail.com
Mon May 7 10:34:46 CDT 2018


Dear all,

I am trying to integrated PETSC in a legacy FEM code, but I had a few
troubles to get the performance of MatSetValues to match the old
subroutines in the sequtial implementation :

1. I use MatSetVaules per element, to add the matrix value to each row and
col this element had, and find it really slow compared with my old
subroutine which directly add the value to a 1-d array to store the value
in CRS format.  For a case with 12K unknown, my old subroutines takes
several seconds, but MatSetValues takes around 50 seconds to finish the
matrix calculation part.... Did I do something wrong, I do have
preallocation giving non-zeros for each row in this MATSEQ matrix...

2. I switched to MatCreateSeqAIJWithArrays, and the performance seems to be
OK.  I do not understand the difference, does MatCreateSeqAIJWithArrays
call MatSetValues internally? or it is just the difference with
INSERT_VALUES vs ADD_VALUES?


3, I want to know the converged rtol,atol of a KSPSolve, how to I do it?

4. I want to do a parallel implement of this too, but worried about the
performance of MatSetValues, should I use MatCreateMPIAIJWithArrays?

Thanks,

Nan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180507/82503097/attachment.html>


More information about the petsc-users mailing list