Analyzing an OpenMP application with EZTrace

Installing EZTrace

First, configure EZTrace as described in the support page.
$ ./configure --prefix=<INSTALLATION_DIR>

If everything is OK, compile and install EZTrace:
$ make &&make install

Check the installation of EZTrace:
$ eztrace_avail
3       stdio   Module for stdio functions (read, write, select, poll, etc.)
2       pthread Module for PThread synchronization functions (mutex, semaphore, spinlock, etc.)
1       omp     Module for OpenMP parallel regions
4       mpi     Module for MPI functions
5       memory  Module for memory functions (malloc, free, etc.)

You should see a module called omp that permits to analyze OpenMP applications.

Running an application with EZTrace

Let's analyze this OpenMP-based FFT application [1]. First, compile it:
$ tar xzvf fft_openmp.tgz
$ gcc -o fft_openmp fft_openmp.c -fopenmp -lm

You can run the application with:
$ ./fft_openmp

You can analyze it with EZTrace by simply adding eztrace -t omp to the command line:
$ eztrace -t omp ./fft_openmp
Only GNU OpenMP runtime functions will be intercepted. For a more precise trace, please instrument your program with eztrace_cc.

However, this only permits to intercept GNU OpenMP runtime calls. The information displayed in the output trace is thus limited.

In order to generate an execution trace that contains all the OpenMP-related events, we need to modify the application. For this, add eztrace_cc to the compilation line:

$ eztrace_cc gcc -o fft_openmp fft_openmp.c -fopenmp -lm

This creates an executable program that contains calls to EZTrace when OpenMP-related events happen. You can then run the program with eztrace:
$ eztrace -t omp ./fft_openmp

This should generate a trace file in /tmp/<username>_eztrace_log_rank_1.

Analyzing the execution of the application

Once the execution traces are generated, we need to analyze them. EZTrace allows to:
Visualizing an execution trace

In order to generate a PAJE/OTF trace file that can be visualized with ViTE or Vampir, you need to run eztrace_convert:

$ eztrace_convert -t PAJE $HOME/traces/${USER}_eztrace_log_rank_*
module stdio loaded
module pthread loaded
module omp loaded
module mpi loaded
module memory loaded
5 modules loaded
no more block for trace #0
141 events handled

This generates a file named paje.trace that you can visualize with ViTE:
$ vite paje.trace

Computing statistics
EZTrace can compute statistics on OpenMP:
$ eztrace_stats $HOME/traces/${USER}_eztrace_log_rank_1

7 parallel regions
CT_Process #0: 7 parallel regions (average duration: 0.018587 us)

[1] The OpenMP-based FFT application is based on John Burkardt implementation.

This tutorial was designed for EZTrace 0.9 or higher. If you encounter any problem, feel free to contact EZTrace developpers.