Turing : Time measurement with libhpcidris

IDRIS has developed the libhpcidris library which allows measuring the execution time of an application by instrumenting it.

A module is available. It allows positioning the paths for the library, the include files and the Fortran modules.

module load libhpcidris

The following is an example of what you obtain on the standard output when using the subroutines HPCIDRIS_F03_MPI_timer_start_synch and HPCIDRIS_F03_MPI_timer_stop_synch in Fortran or HPCIDRIS_MPI_timer_start_synch and HPCIDRIS_MPI_timer_stop_synch in C at detail level 2 :

  ----------------------------------------------------------------------
              ELAPSED TIME (libhpcidris version 4.0)
             (C)2009-2013 Philippe WAUTELET, IDRIS-CNRS
  ----------------------------------------------------------------------
     Max (position)   |   Min (position)   |   Average  |      Sum
  ----------------------------------------------------------------------
    0.094133s (    0) |  0.094133s (    5) |  0.094133s |     0.753062s
  ----------------------------------------------------------------------
  --------------------------------------------------------------------------------
                                SYNCHRONISATION TIME
  --------------------------------------------------------------------------------
           |   Max (position)   |   Min (position)   |   Average  |      Sum
  --------------------------------------------------------------------------------
  At start |  0.000079s (    2) |  0.000001s (    0) |  0.000069s |     0.000550s
  At stop  |  0.082367s (    0) |  0.000005s (    7) |  0.041182s |     0.329453s
  Total    |  0.082368s (    0) |  0.000083s (    7) |  0.041250s |     0.330004s
  --------------------------------------------------------------------------------

Utilisation of libhpcidris in a Fortran program

All the functionalities of time measurement are available by loading the Fortan module hpcidris (or hpcidris_timer). In your Fortran source files, you just need to add the following line in all the places where you use this library:

use hpcidris

The available subroutines are the following:

  • HPCIDRIS_F03_MPI_timer_start(comm) : Begins time measurement on all the processes of the MPI communicator comm. Each process launches the start of its time measurement independantly from the others (and, therefore, without synchronisation).
  • HPCIDRIS_F03_MPI_timer_start_synch(comm) : Begins time measurement with synchronisation on all the processes of the MPI communicator comm. Each process launches the start of its measurement as soon as all the processes are synchronised. The time measurement does not begin, therefore, until after synchronisation. The time passed between the call to this subroutine and the start of the real measurement can be displayed using HPCIDRIS_F03_MPI_timer_stop and HPCIDRIS_F03_MPI_timer_stop_synch with details at a minimum of argument level 2.
  • HPCIDRIS_F03_MPI_timer_stop(comm,level): Stops and displays the time measurement on all of the processes of the MPI communicator comm. Each process stops its time measurement independantly of the others (and, therefore, without synchronisation). HPCIDRIS_F03_MPI_timer_stop is a Fortran function (and not a subroutine) which returns the time measurement in seconds of the process calling in a double precision. The detail level of the display is chosen by the argument level:
    • 0 : No outputs
    • 1 : Summary with max, min, average and total values and the process ranks having the max and min values
    • 2 : Same as 1 but with the synchronisation information (if available)
    • 3 : Detailed outputs for all the processes.
  • HPCIDRIS_F03_MPI_timer_stop_synch(comm,level) : Stops after synchronisation and displays the time measurement on all of the processes of the MPI communicator comm. Each process stops its time measurement after synchronisation. The time passed between the call to this subroutine and the end of the real measurement can be displayed with a detail level of at least 2. The display details are chosen by the argument level:
    • 0 : No outputs
    • 1 : Summary with max, min, average and total values and the process ranks having the max and min values
    • 2 : Same as 1 but with the synchronisation information (if available)
    • 3 : Detailed outputs for all the processes
  • HPCIDRIS_F03_timer_start : Starts the time measurement on the calling processes. This subroutine is not MPI and, therefore, is local to the processes using it.
  • HPCIDRIS_F03_timer_stop : Stops the time measurement. HPCIDRIS_F03_timer_stop is a Fortran function (and not a subroutine) which returns the time measurement in seconds for each process calling it. The values are given in double precision.

Utilisation of libhpcidris in a C program

All the functionalities of time measurement are available by including the hpcidris.h (or hpcidris_timer.h) file. In your C program, you just need to add the following line everywhere that you use this library:

#include ''hpcidris.h''

The available functions are the following:

  • void HPCIDRIS_MPI_timer_start(MPI_Comm comm) : Begins time measurement on all the processes of the MPI communicator comm. Each process launches the start of its time measurement independantly from the others (and, therefore, without synchronisation).
  • void HPCIDRIS_MPI_timer_start_synch(MPI_Comm comm) : Begins time measurement with synchronisation on all the processes of the MPI communicator comm. Each process launches the start of its measurement as soon as all the processes are synchronised. The time measurement does not begin, therefore, until after synchronisation. The time passed between the call to this subroutine and the start of the real measurement can be displayed using HPCIDRIS_F03_MPI_timer_stop and HPCIDRIS_F03_MPI_timer_stop_synch with a detail level of at least 2.
  • double HPCIDRIS_MPI_timer_stop(MPI_Comm comm,int level) : Stops and displays the time measurement on all of the processes of the MPI communicator comm. Each process stops its time measurement independantly of the others (and, therefore, without synchronisation). The value of the return corresponds to the time measurement in seconds for the process calling. The display details are chosen by argument level:
    • 0 : No outputs
    • 1 : Summary with max, min, average and total values and the process ranks having the max and min values
    • 2 : Same as 1 but with the synchronisation information (if available)
    • 3 : Detailed outputs for all the processes.
  • double HPCIDRIS_MPI_timer_stop_synch(MPI_Comm comm,int level) : Stops after synchronisation and displays the time measurement on all of the processes of the MPI communicator comm. Each process stops its time measurement after synchronisation. The time passed between the call to this subroutine and the end of the real measurement can be displayed with a detail level of at least 2. The display details are chosen by argument level:
    • 0 : No outputs
    • 1 : Summary with max, min, average and total values and the process ranks having the max and min values
    • 2 : Same as 1 but with the synchronisation information (if available)
    • 3 : Detailed outputs for all the processes
  • void HPCIDRIS_timer_start() : Starts the time measurement on the calling processes. This subroutine is not MPI and, therefore, is local to the process (or processes) using it.
  • double HPCIDRIS_timer_stop() : Stops the time measurement. The value of the return corresponds to the time measurement in seconds for the calling process.

Comments

  • Calls engender very limited additional costs (inferior to 1 microseconds). However, if the detail level is superior to 0, the display is not instantaneous and causes MPI communications between the processes. The measurements, however, are done before this operation so the display does not perturb the measurements.
  • All the calls beginning by HPCIDRIS_F03_MPI_ are collective calls (in the MPI sense) and must be carried out by all the processes of the specified communicator.
  • Every measurement begun must be stopped one time only.
  • It is completely possible to take a measurement with or without synchronisation at the beginning or at the end (for example, stringing together HPCIDRIS_F03_MPI_timer_start_synch with HPCIDRIS_F03_MPI_timer_stop).