Intel® VTune™ Amplifier

Analyzing MPI Applications

Parallel High Performance Computing (HPC) applications often rely on multi-node architectures of modern clusters. Performance tuning of such applications must involve analysis of cross-node application behavior as well as single-node performance analysis. Intel® Parallel Studio XE Cluster Edition includes such performance analysis tools as Intel Trace Analyzer and Collector and Intel VTune™ Amplifier that can provide important insights to help in this analysis. For example, message passing interface (MPI) communication hotspots, synchronization bottlenecks, load balancing and other complex issues can be investigated using Intel Trace Analyzer and Collector. At the same time, VTune Amplifier can be used to understand intra-node performance issues of MPI applications using fork-join threading through OpenMP* and Intel Threading Building Blocks (Intel TBB).

Use the VTune Amplifier for a single-node analysis including threading when you start analyzing hybrid codes that combine parallel MPI processes with threading for a more efficient exploitation of computing resources. For example, if you use the VTune Amplifier as part Intel Cluster Studio XE, you may use the Intel Trace Analyzer and Collector to identify the hottest MPI function and then use the VTune Amplifier to run the parallel MPI program distributed with n MPI ranks. VTune Amplifier helps you identify which instance of the hot function had the largest contribution to the application runtime.

Note

The version of the Intel MPI library included with the Intel Parallel Studio XE Cluster Edition makes an important switch to use the Hydra process manager by default for mpirun. This provides high scalability across the big number of nodes.

Use these basic steps required to analyze MPI applications with the VTune Amplifier:

  1. Configure installation for MPI analysis.

  2. Configure and run MPI analysis with the VTune Amplifier.

  3. Resolve symbols for MPI modules.

  4. View collected data.

Explore additional information on MPI analysis:

Configuring Installation for MPI Analysis

For MPI application analysis on a Linux* cluster, you may enable the Per-user Hardware Event-based Sampling mode when installing the Intel Parallel Studio XE Cluster Edition. This option ensures that during the collection the VTune Amplifier collects data only for the current user. Once enabled by the administrator during the installation, this mode cannot be turned off by a regular user, which is intentional to preclude individual users from observing the performance data over the whole node including activities of other users.

After installation, you can use the respective -vars.sh files to set up the appropriate environment (PATH, MANPATH) in the current terminal session.

Configuring MPI Analysis with the VTune Amplifier

To collect performance data for an MPI application with the VTune Amplifier, use the following command:

$ mpirun -n <n> -l amplxe-cl -result-dir my_result -quiet -collect <analysis type> my_app [my_app_ options]

where:

To collect data for a subset of MPI processes in the workload, use the per-host syntax of mpirun/mpiexec* and specify different command lines to execute for different processes.

If you use Intel MPI with version 5.0.2 or later you can use the -gtool option for easier selective rank profiling:

$ mpirun -genvall -gtool "amplxe-cl -r <my_result> -collect <analysis type>:<rank_set>[=exclusive]" -n <n> <my_app> [my_app_ options]

where <rank_set> specifies a ranks range no be involved to the tool execution. Separate ranks with a comma or use the “-” symbol for a set of contiguous ranks. Use the all value to configure profiling on all the ranks. exclusive launch mode helps prevent running more than one collection per node, which can be useful for PMU-based profiling. Starting with Intel MPI version 5.0.3 you can use the node-wide clause instead of exclusive to make collection on all ranks of the nodes where the <rank_set> resides on or for all nodes in the case of all ranks. In this case, the VTune Amplifier creates a result directory per node with a host name suffix for the result directory name. This is particularly convenient for PMU-based collections where there are limitations on simultaneous profiling by multiple amplxe-cl commands. For example:

$ mpirun -gtool "amplxe-cl -c advanced-hotspots -r my_dir:all=node-wide" -n 4 -ppn 2 my_mpi_app

Examples:

  1. This example runs the Hotspots analysis type recommended as a starting point:

    $ mpirun -n 4 amplxe-cl -result-dir my_result -collect hotspots -- my_app [my_app_ options]

  2. This example collects Hotspots data for two out of 16 processes in the job distributed across the hosts:

    $ mpirun -host myhost -n 14 ./a.out : -host myhost -n 2 amplxe-cl -result-dir foo -c hotspots ./a.out

    As a result, the VTune Amplifier creates two directories in the current directory: foo.14 and foo.15 (given that process ranks 14 and 15 were assigned to the last two processes in the job).

  3. As an alternative to the previous example, you can create a configuration file with the following content:

    # config.txt configuration file
    -host myhost -n 14 ./a.out
    -host myhost -n 2 amplxe-cl -quiet -collect hotspots -result-dir foo ./a.out

    and run the data collection as:

    $ mpirun -configfile ./config.txt

    to achieve the same result as in the previous example: foo.14 and foo.15 result directories are created.

  4. Similarly, this example uses specific host names to control where the analyzed processes are executed:

    # config.txt configuration file
    -host myhost1 -n 14 ./a.out
    -host myhost2 -n 2 amplxe-cl -quiet -collect hotspots -result-dir foo ./a.out

    When you mention the host names, the VTune Amplifier allocates consecutive MPI ranks to the specified hosts. In this example, ranks 0 to 13, inclusive, will be assigned to myhost1. The remaining ranks 14 and 15 will be assigned to myhost2. You can omit specifying the exact hosts. In this case, the distribution of the processes between the hosts will be done in the round-robin fashion. That is, myhost1 will get MPI ranks 0, 2, and 4 thru 15, while myhost2 will get MPI ranks 1 and 3. The latter behavior may change in the future.

  5. This example runs a system-wide Advanced Hotspot analysis on all nodes with Intel MPI 5.0.2, or later:

    $ mpirun –gtool “amplxe-cl -r my_result -collect advanced-hotspots –analyze-system:all=exclusive” –n 16 ppn -4 my_app [my_app_ options]

  6. This example runs Advanced Hotspots analysis on 1, the first rank from 4-6 launched on node 2, rank 10:

    $ mpirun –gtool “amplxe-cl -r my_result -collect advanced-hotspots: 1,4-6,10” –n 16 ppn -4 my_app [my_app_ options]

Note

The examples above use the mpirun command as opposed to mpiexec and mpiexec.hydra while real-world jobs might use the mpiexec* ones. mpirun is a higher-level command that dispatches to mpiexec or mpiexec.hydra depending on the current default and options passed. All the listed examples work for the mpiexec* commands as well as the mpirun command.

Resolving Symbols for MPI Modules

After data collection, the VTune Amplifier automatically finalizes the data (resolves symbols and converts them to the database). It happens on the same compute node where the command line collection was executing. So, the VTune Amplifier automatically locates binary and symbol files. In cases where you need to point to symbol files stored elsewhere, adjust the search settings using the -search-dir option:

$  mpirun -np
128 amplxe-cl -q -collect hotspots -search-dir /home/foo/syms
./a.out

Viewing Collected Data

Once the result is collected, you can open themitin the graphical or command line interface of the VTune Amplifier.

To view the results in the command line interface:

Use the -report option. To get the list of all available VTune Amplifier reports, enter amplxe-cl -help report.

To view the results in the graphical interface:

Click the menu button and select Open > Result... and browse to the required result file (*.amplxe).

Tip

You may copy a result to another system and view it there (for example, to open a result collected on a Linux* cluster on a Windows* workstation).

VTune Amplifier classifies MPI functions as system functions similar to Intel Threading Building Blocks (Intel TBB) and OpenMP* functions. This approach helps you focus on your code rather than MPI internals. You can use the VTune Amplifier GUI Call Stack Mode filter bar combo box and CLI call-stack-mode option to enable displaying the system functions and thus view and analyze the internals of the MPI implementation. The call stack mode User functions+1 is especially useful to find the MPI functions that consumed most of CPU Time (Basic Hotspots analysis) or waited the most (Locks and Waits analysis). For example, in the call chain main() -> foo() -> MPI_Bar() -> MPI_Bar_Impl() -> ..., MPI_Bar() is the actual MPI API function you use and the deeper functions are MPI implementation details. The call stack modes behave as follows:

Note

VTune Amplifier prefixes the profile version of MPI functions with P, for example: PMPI_Init.

VTune Amplifier provides Intel TBB and OpenMP support. You are recommended to use these thread-level parallel solutions in addition to MPI-style parallelism to maximize the CPU resource usage across the cluster, and to use the VTune Amplifier to analyze the performance of that level of parallelism. The MPI, OpenMP, and Intel TBB features in the VTune Amplifier are functionally independent, so all usual features of OpenMP and Intel TBB support are applicable when looking into a result collected for an MPI process. For hybrid OpenMP and MPI applications, the VTune Amplifier displays a summary table listing top MPI ranks with OpenMP metrics sorted by MPI Communication Spin time from low to high values. The lower the Communication time is, the longer a process was on a critical path of MPI application execution. For deeper analysis, explore OpenMP efficiency metrics by MPI processes laying on the critical path.

Example:

This example displays the performance report for functions and modules analyzed for Hotspots. Note that this example opens individual analysis results each of which was collected for a specific rank of MPI process (foo.14 and foo.15 ):

$ amplxe-cl -R hotspots -q -format text -r foo.14
Function Module CPU Time
-------- ------ --------
f        a.out  6.070
main     a.out  2.990

$ amplxe-cl -R hotspots -q -format text -group-by module -r foo.14
Module CPU Time
------ --------
a.out  9.060

MPI Implementations Support

You can use the VTune Amplifier to analyze both Intel MPI library implementation and other MPI implementations. But beware of the following specifics:

MPI System Modules Recognized by the VTune Amplifier

VTune Amplifier uses the following regular expressions in the Perl syntax to classify MPI implementation modules:

Note

This list is provided for reference only. It may change from version to version without any additional notification.

Analysis Limitations

Additional Resources

For more details on analyzing MPI applications, see the Intel Parallel Studio XE Cluster Edition and online MPI documentation at http://software.intel.com/en-US/articles/intel-mpi-library-documentation/.

There are also other resources available online that discuss usage of the VTune Amplifier with the Intel MPI Library:

See Also