Timing Routines on the JPL Supercomputers
Introduction
Software developers often need to determine the time taken to execute parts
of their programs.
Here we present two routines, one
for MPI programs, and one for any program run within a UNIX/LINUX operating
system, which are easy to incorporate into any program and are reasonably
portable.
Timing Routines
1) MPI_Wtick() and MPI_Wtime() in MPI
MPI provides two timing routines: MPI_Wtick() and
MPI_Wtime().
MPI_Wtick() returns, as a double-precision,
floating-point number, the
resolution of MPI_Wtime() in seconds.
MPI_Wtime() returns,
as a double-precision, floating-point number, the
number of seconds since some arbitrary starting time in the past.
This starting time is guaranteed not to change while your job is running.
2) gettimeofday() and second()
UNIX/LINUX provides the gettimeofday() routine. gettimeofday()
returns the total time (in seconds and microseconds) since the
"birth" of UNIX/LINUX (00:00 01 January 1970).
Since it returns its information in several pieces inside a C
structure, it is cumbersome to use in a C program, and impossible to
call from a Fortran program.
For these reasons, please use second().
The following is a brief description on how to use second():
PURPOSE:
SECOND returns the user time for a process in seconds.
This version gets the time from the system function ETIME.
SYNOPSIS:
Real function SECOND()
IMPLEMENTATION:
This routine is part of the SCSL Scientific Library and can be loaded using either the -lscs or the -lscs_mp option.
When linking to SCSL with -lscs or -lscs_mp, the default integer size is 4 bytes (32 bits). Another version of SCSL is available in which integers are 8 bytes (64 bits). This version allows the user access to larger memory sizes and it can be loaded by using the -lscs_i8 option or the -lscs_i8_mp option.
The -lscs_mp option directs the linker to use the multi-processor version of the library.
Printer Friendly Version
|