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
Linux x86_64 TOSS 3 and TOSS 4 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.

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:icc -profile-functions -profile-loops=all -profile-loops-report=2 test.c

num args = 1, count = 50000000
average = 0.000000
average = 47920821035.180466 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 viewer screenshot

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 2011 CPP update, 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 2011 Fortran update, or by running man ifort.