Synchronization of one function in the MPI / OpenMP hybrid code

I have a hybrid code with MPI / OpenMP. I want to know how much time is spent on a particular function, let them say A, for each MPI process. This function is called inside OpenMP do / for loops in a very complicated way, using various functions on top of it (i.e., some other functions allow us to say that B and C can call A, which can also be inside OpenMP do / for loops), I planned to do it as follows:

double A() { time1 = MPI_Wtime(); //compute result... //Note: inside this function there is no OpenMP or MPI calls... // just pure computation of results... time2 = MPI_Wtime(); printf("myRank=%d timeSpent=%f\n", myRank, (time2-time1)); return result; } 

Will the sum of all times for each MPI process be the total time spent on this function, on this MPI process? If not, please can you show me how to do it right, thanks!

+4
source share
2 answers

We do not want to reinvent the wheel, and we do not want to invent the MPI profiler. That would be hard.

There are very powerful tools available from manufacturers of many cluster systems. For example, Cray machines usually come with a CrayPat that spits out magic .

In addition, there is free software such as http://mpip.sourceforge.net/

+1
source

I would recommend not to reinvent the wheel, but to use some kind of professional software already built for profiling, for example TAU , or MPIP or Gprof ...

heres a worthy presentation to get started

0
source

Source: https://habr.com/ru/post/1446345/


All Articles