wiki:AddingMemoryandTimingInformation

Adding memory and timing information

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:                     2.007 s
  PDAF            init_ens_pdaf:                       2.004 s
  PDAF          Ensemble forecast:                 571.850 s
  PDAF            MPI communication in PDAF:           0.004 s
  PDAF            distribute_state_pdaf:               0.140 s
  PDAF            collect_state_pdaf:                  0.001 s
  PDAF          LESTKF analysis:                    12.654 s
  PDAF            PDAF-internal operations:           10.360 s
  PDAF            init_n_domains_pdaf:                 0.000 s
  PDAF            init_dim_obs_f_pdaf:                 1.091 s
  PDAF            obs_op_f_pdaf:                       0.022 s
  PDAF            init_dim_l_pdaf:                     0.001 s
  PDAF            init_dim_obs_l_pdaf:                 1.136 s
  PDAF            g2l_state_pdaf:                      0.003 s
  PDAF            g2l_obs_pdaf:                        0.007 s
  PDAF            init_obs_l_pdaf:                     0.004 s
  PDAF            prodRinvA_l_pdaf:                    0.023 s
  PDAF            l2g_state_pdaf:                      0.002 s
  PDAF          prepoststep_pdaf:                   91.396 s

This example is from one of our real data assimilation application. Most of the time is spent in for ensmeble forecast. The second most time is spent in prepoststep_pdaf, which is mainly due to the writing of large output files. The analysis step (line LESTKF analysis) took only 12.65s. Most of this time was spent for computations inside PDAF (line PDAF-interal operations, 10.36s), while also init_dim_obs_f_pdaf (the initialization of observation information) and init_dim_obs_l_pdaf (the search for observations within the localization cut-off radius) took some time.

If significant time is spend in one or several of the call-back routines, this gives 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.

Last modified 13 months ago Last modified on Feb 22, 2023, 3:28:02 PM