= Adding memory and timing information =
{{{
#!html
}}}
[[PageOutline(2-3,Contents of this page)]]
== Overview ==
PDAF provides functions to display the memory required by the array allocated inside PDAF. In addition, information about the execution duration of different parts of PDAF can be displayed. These information can be obtained by calling the routine `PDAF_print_info`.
== Displaying memory information ==
Information about the memory required by PDAF through allocated arrays can be obtained by inserting into the program the line
{{{
CALL PDAF_print_info(2)
}}}
The function displays the following information
* Memory required for the ensemble array, state vector, and matrix '''Uinv'''
* Memory required by the analysis step
* Memory required to perform the ensemble transformation
The output will look like this:
{{{
PDAF PDAF Memory overview
PDAF ---------------------------------------------
PDAF Allocated memory (MiB)
PDAF state and A: 0.598 MiB (persistent)
PDAF ensemble array: 0.641 MiB (persistent)
PDAF analysis step: 16.425 MiB (temporary)
}}}
Currently only the memory required by the first process of the filter processes is displayed. Thus the total required memory should be the displayed memory multiplied by the number of processes in `COMM_filter`.
== Displaying timing information ==
Timing information can be displayed by adding
{{{
CALL PDAF_print_info(1)
}}}
to the code. This will provide an output like
{{{
PDAF PDAF Timing information
PDAF ---------------------------------------------
PDAF Initialize PDAF: 0.078 s
PDAF Ensemble forecast: 0.003 s
PDAF LESTKF analysis: 25.183 s
PDAF Prepoststep: 0.017 s
}}}
More detailed output is obtained with
{{{
CALL PDAF_print_info(3)
}}}
which will display timing information of each of the call-back routines. E.g. for the LESTKF this might look like:
{{{
PDAF PDAF Timing information - call-back routines
PDAF ----------------------------------------------------
PDAF Initialize PDAF: 0.078 s
PDAF init_ens_pdaf: 0.077 s
PDAF Ensemble forecast: 0.003 s
PDAF MPI communication in PDAF: 0.000 s
PDAF distribute_state_pdaf: 0.001 s
PDAF collect_state_pdaf: 0.000 s
PDAF LESTKF analysis: 25.183 s
PDAF PDAF-internal operations: 24.762 s
PDAF init_n_domains_pdaf: 0.000 s
PDAF init_dim_obs_f_pdaf: 0.000 s
PDAF obs_op_f_pdaf: 0.003 s
PDAF init_dim_l_pdaf: 0.001 s
PDAF init_dim_obs_l_pdaf: 0.001 s
PDAF g2l_state_pdaf: 0.001 s
PDAF g2l_obs_pdaf: 0.021 s
PDAF init_obs_l_pdaf: 0.000 s
PDAF prodRinvA_l_pdaf: 0.006 s
PDAF l2g_state_pdaf: 0.014 s
PDAF prepoststep_pdaf: 0.017 s
}}}
In this example most time is spend inside PDAF (it is from the PDAF testsuite). If significant time is spend in one of several of the call-back routines, this given an indication which routines might have potential for optimization.
More detailed information in time spend in different parts of the filter algorithm itself can be obtained using a value of 4 or 5 in the call to `PDAF_print_info`. Only the time from the first process of the filter processes is displayed. However, the time for each process should be similar.