[petsc-users] about speed

Barry Smith bsmith at mcs.anl.gov
Tue Jul 27 09:47:35 CDT 2010


  What happens when you use sundials from PETSc. Use -ts_type sundials? Run also with -log_summary and compare the number of function evaluations, timesteps etc

  Without knowing more information about what sundials/cvode is doing there is no way to know why it is much faster. Could be larger time-steps, less function evaluations, etc. 

   Barry

On Jul 27, 2010, at 8:22 AM, Xuan YU wrote:

> 
> On Jul 26, 2010, at 9:51 PM, Barry Smith wrote:
> 
>> 
>> 1) The function evaluations are taking a lot of time; the problem is not with the Jacobian differencing it is that each function evaluation needed by the differencing is slow
>> 
> 
> When I use cvode solve the same preoblem, function evaluations takes 41.42% of total time. And the total time consumption is much less than Petsc.( 5.657seconds VS 2 minutes 33.726 seconds)
> 
> 
> 
> 
>>  2) There are a huge number of SNESFunctionEvaluations, much much more then I would expect, like 10 per nonlinear solve.
>> 
> 
> What is the possible reason for this case?
> 
> 
> 
>>  Barry
>> 
>> 
>> On Jul 26, 2010, at 5:50 PM, Xuan YU wrote:
>> 
>>> 
>>> On Jul 26, 2010, at 3:53 PM, Barry Smith wrote:
>>> 
>>>> 
>>>> ./configure an optimized version of PETSc (that is with the ./configure flag of --with-debugging=0) and run with -log_summary to get a summary of where it is spending the time. This will give you a better idea of why it is taking so long.
>>> 
>>> Does my log summary means the finite difference Jacobian approximation is not good? Should I write analytic jacobian function(that will be a huge amount of work)?
>>> 
>>> 
>>> 
>>> <Picture 3.png>
>>> <Picture 4.png>
>>> 
>>> 
>>> <Picture 5.png>
>>>> 
>>>> Barry
>>>> 
>>>> On Jul 26, 2010, at 2:49 PM, Xuan YU wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I am using TS solving a nonlinear problem. I created an approximate data structure for Jacobian matrix to be used with matcoloring, my MatFDColoringView is like this:
>>>>> <Picture 1.png>
>>>>> 
>>>>> But the speed of code is too slow than what I expected. Only 10 time step costs 11seconds!
>>>>> 
>>>>> What's wrong with my code? How can I speed up?
>>>>> 
>>>>> Thanks!
>>>>> 
>>>>> This is the ts_view result.
>>>>> 
>>>>> TS Object:
>>>>> type: beuler
>>>>> maximum steps=100
>>>>> maximum time=10
>>>>> total number of nonlinear solver iterations=186
>>>>> total number of linear solver iterations=423
>>>>> SNES Object:
>>>>> type: ls
>>>>>  line search variant: SNESLineSearchCubic
>>>>>  alpha=0.0001, maxstep=1e+08, minlambda=1e-12
>>>>> maximum iterations=50, maximum function evaluations=10000
>>>>> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>>>>> total number of linear solver iterations=1
>>>>> total number of function evaluations=19
>>>>> KSP Object:
>>>>>  type: gmres
>>>>>    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
>>>>>    GMRES: happy breakdown tolerance 1e-30
>>>>>  maximum iterations=10000, initial guess is zero
>>>>>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>>>>>  left preconditioning
>>>>>  using PRECONDITIONED norm type for convergence test
>>>>> PC Object:
>>>>>  type: ilu
>>>>>    ILU: out-of-place factorization
>>>>>    0 levels of fill
>>>>>    tolerance for zero pivot 1e-12
>>>>>    using diagonal shift to prevent zero pivot
>>>>>    matrix ordering: natural
>>>>>    factor fill ratio given 1, needed 1
>>>>>      Factored matrix follows:
>>>>>        Matrix Object:
>>>>>          type=seqaij, rows=1838, cols=1838
>>>>>          package used to perform factorization: petsc
>>>>>          total: nonzeros=8464, allocated nonzeros=8464
>>>>>          total number of mallocs used during MatSetValues calls =0
>>>>>            not using I-node routines
>>>>>  linear system matrix = precond matrix:
>>>>>  Matrix Object:
>>>>>    type=seqaij, rows=1838, cols=1838
>>>>>    total: nonzeros=8464, allocated nonzeros=9745
>>>>>    total number of mallocs used during MatSetValues calls =37
>>>>>      not using I-node routines
>>>>> 
>>>>> 
>>>>> Xuan YU
>>>>> xxy113 at psu.edu
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> Xuan YU
>>> xxy113 at psu.edu
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 



More information about the petsc-users mailing list