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!
source share