Download Platform MPI User's Guide - Platform Cluster Manager
Transcript
Profiling
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 Platform MPI provides several options for profiling your applications, you might not need the
profiling interface to write your routines. Platform MPI makes use of MPI profiling interface mechanisms
to provide the diagnostic library for debugging. In addition, Platform 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 might want to measure the time spent in each call to a specific library routine or to create
a log file. You can collect information of interest and then call the underlying MPI implementation
through an alternate entry point as described below.
Routines in the Platform 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 the PMPI_ prefix.
Fortran profiling interface
When writing profiling routines, do not call Fortran entry points from C profiling routines, and visa versa.
To profile Fortran routines, separate wrappers must be written.
For example:
#include <stdio.h>
#include <mpi.h>
int MPI_Send(void *buf, int count, MPI_Datatype type,
int to, int tag, MPI_Comm comm)
{
printf("Calling C MPI_Send to %d\n", to);
return PMPI_Send(buf, count, type, to, tag, comm);
}
#pragma weak (mpi_send mpi_send)
void mpi_send(void *buf, int *count, int *type, int *to,
int *tag, int *comm, int *ierr)
{
printf("Calling Fortran MPI_Send to %d\n", *to);
pmpi_send(buf, count, type, to, tag, comm, ierr);
C++ profiling interface
The Platform MPI C++ bindings are wrappers to C calls. No profiling library exists for C++ bindings. To
profile the C++ interface, write the equivalent C wrapper version of the MPI library routines you want to
profile. For details on profiling the C MPI libraries, see the section above.
Platform MPI User's Guide 159