When I run a PETSc example in parallel with the flag "-log_summary", the first two tables of information look something like this:

                         Max       Max/Min        Avg      Total 
Time (sec):           2.512e-01      1.00547   2.505e-01
Objects:              5.800e+01      1.00000   5.800e+01
Flops:                3.271e+05      1.00590   3.262e+05  1.305e+06
Flops/sec:            1.309e+06      1.01141   1.302e+06  5.207e+06
Memory:               2.471e+05      1.00599              9.856e+05
MPI Messages:         5.200e+01      2.00000   3.900e+01  1.560e+02
MPI Message Lengths:  1.569e+04      2.00000   3.017e+02  4.706e+04
MPI Reductions:       5.060e+02      1.00000

Summary of Stages:   ----- Time ------  ----- Flops -----  --- Messages ---  -- Message Lengths --  -- Reductions --
                        Avg     %Total     Avg     %Total   counts   %Total     Avg         %Total   counts   %Total 
 0:      Main Stage: 2.3873e-01  95.3%  1.3047e+06 100.0%  1.440e+02  92.3%  2.954e+02       97.9%  4.870e+02  96.2% 
 1:        Assembly: 1.1753e-02   4.7%  0.0000e+00   0.0%  1.200e+01   7.7%  6.308e+00        2.1%  1.800e+01   3.6% 

When I am profiling the parallel performance, I usually think that I should use some sort of "total execution time" metric. However, the log_summary seems to give several measures of time. Which among them can I use as the "overall execution time"? Are there other metrics which are important to pay attention to when profiling the performance?

  • 7
    $\begingroup$ Most problems/questions that you seem to have with PETSc are all discussed in the manual. $\endgroup$
    – stali
    Jan 26, 2012 at 17:08

1 Answer 1


PETSc keeps profile statistics on each MPI process, then reduces them to obtain an average, maximum, and minimum for each. If you are interested in the total execution time of your job, that will be equivalent to the first entry in the first column, though I should warn you that 0.2 seconds is likely not an interesting example to study for profiling.

If you are concerned about load balance, you would look at the max/min ratio and the average (your job seems fairly balanced). The other metrics can give you a better understanding of where time is being spent in your code, as the PETSc library provides lightweight profiling, flop counting, and MPI message tracking.

  • 3
    $\begingroup$ The manual has a huge section on this as well. Teach a practitioner how to read -log_summary and they'll be back asking about performance bottlenecks in their PETSc code. Teach them to read the PETSc manual and they'll ... read the PETSc manual. mcs.anl.gov/petsc/petsc-current/docs/manual.pdf $\endgroup$ Jan 27, 2012 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.