<div dir="ltr">Dear all,<div><br></div><div>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 :</div><div><br></div><div>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...</div><div><br></div><div>2. I switched to <h1 style="display:inline"><font size="2"><span style="font-weight:normal">MatCreateSeqAIJWithArrays, and the performance seems to be OK.  I do not understand the difference, does </span></font></h1>MatCreateSeqAIJWithArrays call MatSetValues internally? or it is just the difference with INSERT_VALUES vs ADD_VALUES?</div><div><br></div><div><br></div><div>3, I want to know the converged rtol,atol of a KSPSolve, how to I do it?</div><div><br></div><div>4. I want to do a parallel implement of this too, but worried about the performance of MatSetValues, should I use MatCreateMPIAIJWithArrays?</div><div><br></div><div>Thanks,</div><div><br></div><div>Nan</div></div>