[petsc-users] (no subject)

Smith, Barry F. bsmith at mcs.anl.gov
Mon Dec 2 01:03:34 CST 2019


  How many colors is it requiring?   And how long is the MatGetColoring() taking? Are you running in parallel?  The MatGetColoring() MATCOLORINGSL uses a sequential coloring algorithm so if your matrix is large and parallel the coloring will take a long time. The parallel colorings are MATCOLORINGGREEDY and MATCOLORINGJP

  Barry


> On Dec 1, 2019, at 12:56 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.



More information about the petsc-users mailing list