Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Parallel Programming Guide for HP-UX Systems > Chapter 2 MPI

Profiling

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

The following provides information about utilities you can use to analyze
HP MPI applications. The topics covered are:

Using counter instrumentation

Counter instrumentation is a lightweight method for generating cumulative runtime statistics for your MPI applications. When you create an instrumentation profile, HP MPI creates an ASCII format.

You can create instrumentation profiles for applications linked with the standard HP MPI library, and for applications linked with HP MPI version 2.0, you can also create profiles for applications linked with the thread-compliant library. Instrumentation is not supported for applications linked with the diagnostic library (-ldmpi).

Creating an instrumentation profile

Create an instrumentation profile using one of the following methods:

  • Use the following syntax:

    mpirun -i spec -np # program

    For example, to create an instrumentation profile for an application called compute_pi.f, enter:

    % $MPI_ROOT/bin/mpirun -i compute_pi -np 2 compute_pi

    This invocation creates an instrumentation profile in the following format: compute_pi.instr (ASCII).

  • Specify a filename prefix using the MPI_INSTR environment variable. For example,

    % setenv MPI_INSTR compute_pi

    Specifies the instrumentation output file prefix as compute_pi.

Specifications you make using mpirun -i override any specifications you make using the MPI_INSTR environment variable.

MPIHP_Trace_on and MPIHP_Trace_off

By default, the entire application is profiled from MPI_Init to MPI_Finalize. However, HP MPI provides the nonstandard MPIHP_Trace_on and MPIHP_Trace_off routines to collect profile information for selected code sections only.

To use this functionality:

  1. Insert the MPIHP_Trace_on and MPIHP_Trace_off pair around code that you want to profile.

  2. Build the application and invoke mpirun with the -i off option.
    -i off specifies that counter instrumentation is enabled but initially turned off. Data collection begins after all processes collectively call MPIHP_Trace_on. HP MPI collects profiling information only for code between MPIHP_Trace_on and MPIHP_Trace_off

CAUTION: MPIHP_Trace_on and MPIHP_Trace_off are collective routines and must be called by all ranks in your application. Otherwise, the application deadlocks.

Viewing ASCII instrumentation data

The ASCII instrumentation profile is a text file with the .instr extension. For example, to view the instrumentation file for the compute_pi.f application, you can print the prefix.instr file. If you defined prefix for the file as compute_pi, as you did when you created the instrumentation file in “Creating an instrumentation profile”, you would print compute_pi.instr.

The ASCII instrumentation profile provides the version, the date your application ran, and summarizes information according to application, rank, and routines. Figure 2-3 “ASCII instrumentation profile” is an example of an ASCII instrumentation profile.

The information available in the prefix.instr file includes:

  • Overhead time—The time a process or routine spends inside MPI. For example, the time a process spends doing message packing.

  • Blocking time—The time a process or routine is blocked waiting for a message to arrive before resuming execution.

NOTE: If spin-yield time is changed, overhead and blocking times become less accurate.
  • Communication hot spots—The processes in your application between which the largest amount of time is spent in communication.

  • Message bin—The range of message sizes in bytes. The instrumentation profile reports the number of messages according to message length.

NOTE: You do not get message size information for MPI_Alltoallv instrumentation.

Figure 2-3 “ASCII instrumentation profile” displays the contents of the example report compute_pi.instr.

Figure 2-3 ASCII instrumentation profile

 Version: HP MPI 01.08.00.00 B6060BA - HP-UX 11.0 Date:    Mon Apr 01 15:59:10 2002 Processes: 2 User time:   6.57% MPI time :  93.43% [Overhead:93.43% Blocking:0.00%] -------------------------------------------------------------------------------------   Instrumentation Data -------------------- ----------------------------------------------------------------- Application Summary by Rank (second): Rank       Proc CPU Time     User Portion       Sytem Portion -----------------------------------------------------------------   0      0.040000        0.010000( 25.00%)     0.030000( 75.00%)   1      0.030000        0.010000( 33.33%)     0.020000( 66.67%) ----------------------------------------------------------------- Rank       Proc Wall Time      User                  MPI -----------------------------------------------------------------   0       0.126335     0.008332(  6.60%)       0.118003( 93.40%)   1       0.126355     0.008260(  6.54%)       0.118095( 93.46%) ----------------------------------------------------------------- Rank       Proc MPI Time      Overhead              Blocking -----------------------------------------------------------------   0        0.118003       0.118003(100.00%)    0.000000(  0.00%)   1        0.118095       0.118095(100.00%)    0.000000(  0.00%) ----------------------------------------------------------------- Routine Summary by Rank: Rank   Routine   Statistic   Calls   Overhead(ms)   Blocking(ms) -----------------------------------------------------------------    0MPI_Bcast                       1        5.397081        0.000000MPI_Finalize                    1        1.238942        0.000000MPI_Init                        1      107.195973        0.000000MPI_Reduce                      1        4.171014        0.000000 -----------------------------------------------------------------    1MPI_Bcast                       1        5.388021        0.000000MPI_Finalize                    1        1.325965        0.000000MPI_Init                        1      107.228994        0.000000MPI_Reduce                      1        4.152060        0.000000 ----------------------------------------------------------------- Message Summary by Rank Pair: SRank    DRank  Messages (minsize,maxsize)/[bin]    Totalbytes -----------------------------------------------------------------    0             1      1          (4, 4)                  4                    1          [0..64]                 4 -----------------------------------------------------------------    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>
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 _HP_SECONDARY_DEF 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);
}
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.