Intel Profiler

  1. Overview
  2. Platforms and Locations
  3. Quick Start
  4. Documentation and References

Overview

The Intel version 12 compilers include options to gather profiles of loops and functions, which may be useful in identifying where your application is spending its time.


Platforms and Locations

    Platform Location Notes
    x86_64 Linux Included with the Intel 12+ compilers  
    BG/Q Not available  

Quick Start

The Intel compilers can be accessed with the icc, icpc, and ifort commands for C, C++, and Fortran, respectively. These commands will run the LC "default" version. MPI wrappers exist for each command and can be accessed by prefixing the compiler command with "mpi" (i.e., mpiicc, mpiicpc, and mpiifort). Additional versions can be run by appending the version number to the compiler command, such as icc-12.1.273 or mpiifort-11.1.046, or the by using version specific dotkits (i.e., use ic-9.1.052) and then invoking icc, mpiifort, etc.

To run the loop and function profiler, add the -profile-functions or -profile-loops compiler flags and run your code. The output can then be viewed with a GUI that comes with the compiler. An example session is provided below.

rzmerl156@lee218:cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MY_SIZE 50000000

int main(int argc, char *argv[])
{
    double x[MY_SIZE], y[MY_SIZE], z[MY_SIZE], b[MY_SIZE], avg = 0.0;
    int i, count;

    count = MY_SIZE;
    if (argc > 1)
        count = atoi(argv[1]);
    printf("num args = %d, count = %d\n", argc, count);
    for (i = 0; i < MY_SIZE; i++)
    {
        x[i] = rand();
        y[i] = rand();
        z[i] = rand();
    }
    for (i = 0; i < count; i++)
        b[i] = x[i] * y[i] + z[i];
    printf("average = %lf\n", avg);
    for (i = 0; i < count; i++)
        avg = b[i] / count;
    printf("average = %lf\n", avg);
    return 0;
}

rzmerl156@lee218:use ic-12.1.273
Prepending: ic-12.1.273 (ok)

rzmerl156@lee218:icc -profile-functions -profile-loops=all -profile-loops-report=2 test.c

rzmerl156@lee218:a.out
num args = 1, count = 50000000
average = 0.000000
average = 47920821035.180466

rzmerl156@lee218:loopprofileviewer.sh loop_prof_1330731488.xml
Note 1: The loopprofileviewer script is in my $PATH because I used the ic-12.1.273 dotkit. It is otherwise accessible in /usr/local/tools/icc-12.1.273/bin (or the bin directory of a different icc version or ifort version)
Note 2: There is also a loopprofilerviewer.csh script for C shell users.

Loop profile veiwer screen shot

Refer to the compiler man pages or the full compiler documentation for more details.

Documentation and References

Documentation for the Intel C/C++ compiler can be found in /usr/local/tools/icc/Documentation/en_US/documentation_c.htm, or on Intel's Web site, or by running man icc or man icpc. Documentation for the Intel Fortran compiler can be found in /usr/local/tools/ifort/Documentation/en_US/documentation_f.htm, or on Intel's Web site, or by running man ifort.

Top