[petsc-users] Amortizing calls to PetscOptionsFindPair_Private()

Jed Brown jed at jedbrown.org
Fri Jan 15 17:53:11 CST 2016


"Bhalla, Amneet Pal S" <amneetb at live.unc.edu> writes:

> Hi Barry,
>
> In our code at each timestep we build MG level smoothers using PETSc
> KSP solvers. 

Do you need to create new objects versus merely resetting them?  I
suspect that calling KSPReset() between timesteps instead of creating a
new object and calling KSPSetFromOptions() will fix your performance
woes.

> We are using a PETSc function KSPSetFromOptions() after we set some
> default values to the KSP. However, the profiler is showing that
> PetscOptionsFindPair_Private() is taking about 14% of total runtime.
> We ran the code for 100 timesteps, and preconditioner is built
> everytime step. I am posting a sequence of calls to
> KSPSolve_Richardson that shows getting PETScOptions adds up to a lot
> of cost
>
> "KSPSolve_Richardson" 	       8.80e+05 12.7% 	
>    "PCApplyBAorAB" 	               5.25e+05  7.6% 	
>      "PCApply" 	                               4.85e+05  7.0% 	
>        "PCApply_ASM" 	               4.85e+05  7.0% 	
>          "KSPSolve" 	                       4.53e+05  6.6% 	
>            "KSPSolve_PREONLY"                      2.06e+05  3.0% 	
>            "PetscObjectViewFromOptions" 	       3.19e+04  0.5% 	
>            "PetscObjectViewFromOptions" 	       2.39e+04  0.3% 	
>            "PetscOptionsGetBool" 	               2.39e+04  0.3% 	
>            "PetscOptionsHasName" 	               2.39e+04  0.3% 	
>           "PetscOptionsGetBool" 	               2.39e+04  0.3% 	
>           "PetscOptionsHasName" 	               1.60e+04  0.2% 	
>           "PetscOptionsGetBool" 	               1.60e+04  0.2% 	
>           "PetscObjectViewFromOptions" 	       1.60e+04  0.2% 	
>           "KSPReasonViewFromOptions" 	       1.60e+04  0.2% 	
>           "PetscOptionsGetBool" 	               1.56e+04  0.2% 	
>           "PetscObjectViewFromOptions" 	        7.98e+03  0.1% 	
>           "KSPSetUpOnBlocks" 	                        7.98e+03  0.1% 	
>           "PetscOptionsGetBool" 	                7.98e+03  0.1% 	
>           "VecSet" 	                                        7.97e+03  0.1% 	
>           "PetscObjectViewFromOptions" 	        7.92e+03  0.1%
>
> Do you have some suggestions as to doing it in a fast way -- maybe parsing options only once in the simulation and making populating KSP 
> options essentially a no-op?
>
> Thanks,
> --Amneet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160115/ec12edb9/attachment.pgp>


More information about the petsc-users mailing list