[petsc-users] Performance of PETSc TS solver

Shri abhyshr at mcs.anl.gov
Fri Aug 16 16:29:33 CDT 2013


Is it possible for you to share the IJacobian code? That would help us to understand the issue better and faster.

Thanks,
Shri

On Aug 16, 2013, at 4:07 PM, Barry Smith wrote:

> 
> On Aug 16, 2013, at 4:01 PM, "Jin, Shuangshuang" <Shuangshuang.Jin at pnnl.gov> wrote:
> 
>> Hello, Jed, in my IJacobian subroutine, I defined a PetscScalar J[4*n][4*n], and filled in the values for this J matrix by MatSetValues(). 
> 
>  What is n?
> 
>   It should not be taking anywhere this much time. How sparse is the matrix? Do you preallocate the nonzero structure? Do you reuse the same matrix for each time step?
>> 
>> 245 seconds out of the total 351 seconds in the DAE TS solving part are due to this J matrix computation.
>> 
>> For that J matrix, half of them are constants values which doesn't change in each iteration. However, since my J is created inside each IJacobian() call, I couldn't reuse it. If that part of work belongs to redundant computation, I would like to know if there's a way to set up the Jacobian matrix outside of the IJacobian() subroutine, so that I can keep the constant part of values in J for all the iterations but only updates the changing values which depends on X?
> 
> MatStoreValues() and MatRetrieveValues() but you can only call this after you have assembled the matrix with the correct nonzero structure. So you need to put the constants values in, put zeros in all the locations with non constant values (that are not permeant zeros), call MatAssemblyBegin/End() then call MatStoreValues() then for each computation of the Jacobian you first call MatRetrieveValues() and then put in the non constant values. Then call MatAssemblyBegin/End()
> 
>   Barry
> 
>> 
>> Thanks,
>> Shuangshuang
>> 
>> -----Original Message-----
>> From: Jed Brown [mailto:five9a2 at gmail.com] On Behalf Of Jed Brown
>> Sent: Thursday, August 15, 2013 7:27 PM
>> To: Jin, Shuangshuang
>> Cc: petsc-users at mcs.anl.gov
>> Subject: RE: [petsc-users] Performance of PETSc TS solver
>> 
>> "Jin, Shuangshuang" <Shuangshuang.Jin at pnnl.gov> writes:
>> 
>>> Hi, Jed,
>>> 
>>> I followed your suggestion and profiled the IJacobian stage, please see the related profile below:
>> 
>> Cool, all of these are pretty inexpensive, so your time is probably in compu
> 



More information about the petsc-users mailing list