PHASTA/Creating Timers
This is a page to document how to create timers in PHASTA. Timers are ways of precisely timing how long a specific part of code takes to execute while having a very low overhead when doing so.
Also see PHASTA#Timings for information on reading the timers section of the PHASTA output log.
Code Changes
There are several places where code needs to change (all paths relative to [phasta git repository]/phSolver/
:
-
common/common.h
- Place definitions of variables to be used for Fortran
-
common/common_c.h
- Ditto, but for C/C++
-
common/new_interface.c
- Where the timer information gets printed out to the log
-
{in,}commpressible/itrdrv.f
- Where the variables tracking the timers get reset
- Whatever code you want to time will need to be modified
common/common.h
Simply need to add a r*
and/or i*
variable to the mpistats
, where the r
stands for a real number and the i
is for an integer.
The real numbers are used to track the actual time it takes to run a specific piece of code, while the integer values are used to track how many times a piece of code can be run.
common/common_c.h
Add the same variables you added to common/common.h
to the mpistats
struct. Note that capitalization doesn't matter in Fortran, but does in C/C++.
common/new_interface.c
Add a print statement to the print_mpi_stats
function. You can simply copy/paste an example