AMReX-Codes / amrex

AMReX: Software Framework for Block Structured AMR
https://amrex-codes.github.io/amrex
Other
506 stars 337 forks source link

Tiny Profiler: Runtime Options (Enable/Disable, Filename) #3895

Open ax3l opened 3 months ago

ax3l commented 3 months ago

As discussed today with @WeiqunZhang @AlexanderSinn in the WarpX developer meeting: Adding a few more runtime options in AMReX to optionally redirect the tiny profiler table summary into a file (and also to disable prints) would be awesome (e.g., for Python runs).

Current option

A C++ output stream that would be user-implemented (in apps), e.g., to pass an fstream.

New Options?

A runtime option that defaults to 1 if TP is compiled, but can be disabled to supress printing the table (or profiling altogether even? Maybe two options?)

tiny_profiler.enabled = 1
tiny_profiler.print = 1

A runtime option to set an fstream as a runtime option (so apps can default it and users can overwrite it)

tiny_profiler.outname = "diags/profile.txt"  # default: none, using stdout
DerNils-git commented 2 months ago

We also just discussed the Tiny-profiling tool within the GEMPIC meeting today and came up with a feature request that might be related.

Could an optional label be added to the amrex::parallel_for(...,"MyParallelRegionLabel"), which would be forwarded to a tiny profiling call within the amrex parallel for? The Kokkos profiling tools provide a similar feature for the parallel regions which is really helpful for quick profiling and identifying compute expensive kernels within a simulation.

Should I open a new issue for the request or can this issue be extended by the feature request?

WeiqunZhang commented 2 months ago

@DerNils-git Please open a new issue.