TDycores-Project / TDycore

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

tdyprof, a Python script, can be used with cvs files generated by -tdy_timers. #99

Closed jeff-cohere closed 3 years ago

jeff-cohere commented 3 years ago

This was inspired by the pprof tool. We can expand upon it or not. Currently, it just prints out the top N most expensive timings in a columnated style. The script is self-contained, with the CSV data generated by PETSc embedded directly into it, so you can copy it wherever and it'll still work.

Here's what I get when I use it with the Richards demo (built against PETSc 3.14):

$ ./richards_driver -dim 3 -Nx 100 -Ny 100 -Nz 10 -tdy_timers -final_time 3
...

$ ./tdyprof top20
tdyprof: showing top 20 hits:
          Stage Name                               Event Name       Time             FLOP
          Main Stage                                  summary    52.6465      2.81967e+09
          Main Stage               TDyTimeIntegratorRunToTime    51.9921      2.80153e+09
          Main Stage                                SNESSolve     51.911      2.80153e+09
          Main Stage                         SNESJacobianEval    48.5132      3.33636e+08
          Main Stage              TDyMPFAOSNESJacobian_3DMesh    48.5132      3.33636e+08
          Main Stage        TDyMPFAOIJacobian_Vertices_3DMesh    48.1652      3.31836e+08
       TDycore Setup                                  summary    21.7687         1.44e+07
       TDycore Setup                   TDyDriverInitializeTDy    20.9909         1.44e+07
       TDycore Setup                                 TDySetup    10.9106         1.44e+07
       TDycore Setup                       TDyMPFAOInitialize    10.9106         1.44e+07
       TDycore Setup                              DMCreateMat    10.0737               0.
       TDycore Setup                        TDyCreateJacobian    10.0737               0.
       TDycore Setup                           DMPlexPrealloc    10.0698               0.
       TDycore Setup            ComputeTransmissibilityMatrix    2.81786               0.
       TDycore Setup   TDyComputeTransmissibilityMatrix3DMesh    2.81784               0.
       TDycore Setup ComputeTransmissibilityMatrix_ForNonCorn    2.73601               0.
       TDycore Setup                     TDyQuadrilateralArea    1.87204               0.
          Main Stage                         SNESFunctionEval    1.81157      4.11471e+08
          Main Stage              TDyMPFAOSNESFunction_3DMesh    1.81152      4.11471e+08
          Main Stage                           SNESLineSearch     1.6678      4.63476e+08
codecov-io commented 3 years ago

Codecov Report

Merging #99 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #99   +/-   ##
=======================================
  Coverage   84.41%   84.41%           
=======================================
  Files          45       45           
  Lines       10176    10176           
=======================================
  Hits         8590     8590           
  Misses       1586     1586           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 91166e6...66fca30. Read the comment docs.

bishtgautam commented 3 years ago

@jeff-cohere Instead of generating ./tdyprof from the C code, how about creating a script (say tools/tdyprof) that reads tdycore_profile.csv?

jeff-cohere commented 3 years ago

Sure, that's easy.

jeff-cohere commented 3 years ago

Okay, I've removed the script generation logic and placed tdyprof into the tools/ directory. Documentation is here.

jeff-cohere commented 3 years ago

However, I think I need to handle the fact that different processes generate distinct timing entries for nproc > 1. That doesn't seem too difficult, though.