Parallel Programming Guide for HP-UX Systems

MPI
Profiling
Chapter 2 75
1
0 1 (8, 8) 8
1 [0..64] 8
-----------------------------------------------------------------
Using the profiling interface
The MPI profiling interface provides a mechanism by which implementors of profiling tools
can collect performance information without access to the underlying MPI implementation
source code.
Because HP MPI provides several options for profiling your applications, you may not need
the profiling interface to write your own routines. HP MPI makes use of MPI profiling
interface mechanisms to provide the diagnostic library for debugging. In addition, HP MPI
provides tracing and lightweight counter instrumentation.
The profiling interface allows you to intercept calls made by the user program to the MPI
library. For example, you may want to measure the time spent in each call to a certain library
routine or create a log file. You can collect your information of interest and then call the
underlying MPI implementation through a name shifted entry point.
All routines in the HP MPI library begin with the MPI_ prefix. Consistent with the “Profiling
Interface” section of the MPI 1.2 standard, routines are also accessible using the PMPI_ prefix
(for example, MPI_Send and PMPI_Send access the same routine).
To use the profiling interface, write wrapper versions of the MPI library routines you want the
linker to intercept. These wrapper routines collect data for some statistic or perform some
other action. The wrapper then calls the MPI library routine using its PMPI_ prefix.
Fortran profiling interface
To facilitate improved Fortran performance, we no longer implement Fortran calls as
wrappers to C calls. Consequently, profiling routines built for C calls will no longer cause the
corresponding Fortran calls to be wrapped automatically. In order to profile Fortran routines,
separate wrappers need to be written for the Fortran calls.
For example:
#include <stdio.h>
#include <mpi.h>