11
May
0

[Openmp][MPI] Profiling hybrid openmp-mpi application with eztrace and vite

In this post I present quickly an example to profile openmp (or pthread) and mpi application.

In this post I use eztrace because it is easy to install and to use!
(the most easy I found all around the globe, and not because it come from INRIA where I am actually working…)

Install

First Download “eztrace” :
http://eztrace.gforge.inria.fr/
You can find help here :
http://eztrace.gforge.inria.fr/doc_0.5.html

Uncompress eztrace-0.6.tar.gz and do :

cd eztrace-0.6
./configure
make
sudo make install

When I did the last command I had many errors.
This errors were ignored when I pushed “enter”,
so I let the key enter pressed during 1 minutes :)

Another error was that some of the eztrace lib were not correclty installed
(even if they were correclty compiled).

So I need to use this command to make the things running :

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/[somewhere]/eztrace-0.6/src/core/.libs/

From here I can say what kind of module I want to use :

export EZTRACE_TRACE=omp

(it is possible to use mpi or pthreads)

Example

The code is :

#include <stdio.h>

#include <omp.h>

void wait(int i){
    const double tt = omp_get_wtime();
    while(omp_get_wtime() - tt < i);
}

void test(){
        #pragma omp parallel num_threads(4)
	{
            #pragma omp single
            {
                printf("I am %d in the single section to wait 2s\n",omp_get_thread_num());
                wait(2);
            }

            #pragma omp for
            for(int i = 0 ;i < 3 ; ++i){
                printf("I am %d in the for section to wait %ds\n",omp_get_thread_num(),1+i);
                    wait(1 + i);
            }
	}
}

int main(){
        test();
	return 0;
}

To compile (with -g)

#compile
g++ -g main.cpp -fopenmp -lgomp -o test
# test with eztrace
eztrace ./test

# it generate a file in /tmp dir :
eztrace_stats /tmp/berenger_eztrace_log_rank_1

#output of the previous command :
eztrace_stats /tmp/berenger_eztrace_log_rank_1module stdio loaded
module pthread loaded
module omp loaded
module memory loaded
4 modules loaded
no more block for trace #0

STDIO:
-------

PThread:
-------
0 locks acquired

GNU OpenMP:
----------
1 parallel regions

MEMORY:
-------
24 events handled

Then we convert the file to paje format:

eztrace_convert -o my_paje /tmp/berenger_eztrace_log_rank_1

Vite

Install vite:
http://vite.gforge.inria.fr/index.php

Then you can look at the result of the previous example with:

vite my_paje.trace
mpi openmp trace eztrace vite

mpi openmp trace eztrace vite

We can detailed this image as :
Vite openmp

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.

Comments are closed.

Celadon theme by the Themes Boutique