[petsc-users] (no subject)

Mark Adams mfadams at lbl.gov
Sun Dec 1 06:43:09 CST 2019


FM matrices are slow and meant for debugging mostly (I thought,
although the docs just give this warning if coloring is not available).

I would check the timings from -log_view and verify that the time is spent
in MatFDColoringApply. Running with -info should print the number of colors
(C). The cost of an FD matrix is about C x cost of an exact Jacobian.
Roughly. You could check that.

Mark

On Sun, Dec 1, 2019 at 3:58 AM Li Luo <li.luo at kaust.edu.sa> wrote:

> Dear Developers,
>
> I tried to use the multi-color finite-difference (MC-FD) method for
> constructing the Jacobians. However, I find it is very slow compared to the
> exact Jacobian.
> My implementation of MC-FD Jacobian is posted below, would you please
> check whether I am correct? Anything missed? Thank you!
>
> ////////// Setup phase:
>           MatStructure flag;
>           ISColoring   iscoloring;
>           ierr = MatGetColoring(Jac,MATCOLORINGSL,&iscoloring);
>           ierr = MatFDColoringCreate(Jac,iscoloring,&this->matfdcoloring);
>           ierr =
> MatFDColoringSetFunction(this->matfdcoloring,(PetscErrorCode
> (*)(void))__libmesh_petsc_snes_residual,(void *)this);
>           ierr = MatFDColoringSetFromOptions(this->matfdcoloring);
>           ierr = ISColoringDestroy(&iscoloring);
>
> //////////// Apply:
>           ierr = MatZeroEntries(*jac);CHKERRQ(ierr);
>           ierr =
> MatFDColoringApply(*jac,solver->matfdcoloring,x,msflag,snes);
>
> Best regards,
> Li Luo
>
> ------------------------------
> This message and its contents, including attachments are intended solely
> for the original recipient. If you are not the intended recipient or have
> received this message in error, please notify me immediately and delete
> this message from your computer system. Any unauthorized use or
> distribution is prohibited. Please consider the environment before printing
> this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191201/416d605c/attachment.html>


More information about the petsc-users mailing list