[petsc-dev] Discussion about time-dependent optimization moved from PR

Jed Brown jed at jedbrown.org
Tue Oct 17 12:22:12 CDT 2017


Stefano Zampini <stefano.zampini at gmail.com> writes:

> attached the patch for ts ex2.c to reproduce the problem.
> It runs 30 times the same TSSolve with a TS that has a RHSJacobian and
> BEULER as a solver.

Thanks.

https://bitbucket.org/petsc/petsc/commits/1e3d8eccaccf8d08bd0d0444380c7e269e8f696e

> This are the times for each solve on my workstation
>
> [szampini at localhost tutorials]$ ./ex2
> 0.164751
> 0.1406
> 0.148703
> 0.158375
> 0.169456
> 0.172364
> 0.179924
> 0.186967
> 0.195149
> 0.202559
> 0.214942
> 0.217264
> 0.225801
> 0.232413
> 0.240205
> 0.249077
> 0.256062
> 0.262738
> 0.270429
> 0.277631
> 0.285879
> 0.292678
> 0.299828
> 0.307717
> 0.315533
> 0.323094
> 0.330388
> 0.338611
> 0.345624
> 0.35268
>
> You can see that timings (for the same exact solve) increase. If I comment
> out DMCoarsenHookAdd in SNESSetUpMatrices
>
> [szampini at localhost tutorials]$ git diff
> /home/szampini/src/petsc/src/snes/interface/
> diff --git a/src/snes/interface/snes.c b/src/snes/interface/snes.c
> index d366a2cc69..cdb7571869 100644
> --- a/src/snes/interface/snes.c
> +++ b/src/snes/interface/snes.c
> @@ -642,7 +642,7 @@ PetscErrorCode SNESSetUpMatrices(SNES snes)
>      KSP ksp;
>      ierr = SNESGetKSP(snes,&ksp);CHKERRQ(ierr);
>      ierr =
> KSPSetComputeOperators(ksp,KSPComputeOperators_SNES,snes);CHKERRQ(ierr);
> -    ierr =
> DMCoarsenHookAdd(snes->dm,DMCoarsenHook_SNESVecSol,DMRestrictHook_SNESVecSol,snes);CHKERRQ(ierr);
> +    //ierr =
> DMCoarsenHookAdd(snes->dm,DMCoarsenHook_SNESVecSol,DMRestrictHook_SNESVecSol,snes);CHKERRQ(ierr);
>    }
>    PetscFunctionReturn(0);
>  }
>
> this is what I get, constant timings as expected
>
> [szampini at localhost tutorials]$ ./ex2
> 0.154417
> 0.125632
> 0.125743
> 0.126303
> 0.125648
> 0.125593
> 0.125647
> 0.125656
> 0.125705
> 0.125705
> 0.125737
> 0.125648
> 0.125592
> 0.125568
> 0.125578
> 0.125678
> 0.125628
> 0.126056
> 0.125725
> 0.127705
> 0.126028
> 0.125671
> 0.125675
> 0.125662
> 0.125688
> 0.125767
> 0.12574
> 0.125604
> 0.125568
> 0.1256


More information about the petsc-dev mailing list