Matrix creation/destruction

John Fettig john.fettig at gmail.com
Tue Aug 25 13:25:39 CDT 2009


I'm trying to understand where matrices get created and destroyed, because I
have a mismatch in the -log_summary of my code but I can't figure out
where.  Running ksp/ksp/examples/tutorials/ex2 with 4 processors, the log
summary looks like:

Event                Count      Time (sec)
Flops                             --- Global ---  --- Stage ---   Total
                   Max Ratio  Max     Ratio   Max  Ratio  Mess   Avg len
Reduct  %T %F %M %L %R  %T %F %M %L %R Mflop/s
------------------------------------------------------------------------------------------------------------------------

--- Event Stage 0: Main Stage

MatMult                9 1.0 1.9534e-03 1.5 1.06e+03 1.1 5.4e+01 5.6e+01
0.0e+00  3 22 82 94  0   4 22100100  0     2
MatSolve               9 1.0 1.7405e-05 1.1 8.10e+02 1.0 0.0e+00 0.0e+00
0.0e+00  0 18  0  0  0   0 18  0  0  0   186
MatLUFactorNum         1 1.0 4.2915e-05 5.3 7.60e+01 1.0 0.0e+00 0.0e+00
0.0e+00  0  2  0  0  0   0  2  0  0  0     7
MatILUFactorSym        1 1.0 1.2922e-04 2.0 0.00e+00 0.0 0.0e+00 0.0e+00
3.0e+00  0  0  0  0  5   0  0  0  0  7     0
MatGetRowIJ            1 1.0 9.5367e-07 0.0 0.00e+00 0.0 0.0e+00 0.0e+00
0.0e+00  0  0  0  0  0   0  0  0  0  0     0
MatGetOrdering         1 1.0 6.6996e-05 2.3 0.00e+00 0.0 0.0e+00 0.0e+00
2.0e+00  0  0  0  0  3   0  0  0  0  5     0
VecMDot                8 1.0 1.3049e-03 2.0 9.72e+02 1.0 0.0e+00 0.0e+00
8.0e+00  2 21  0  0 12   2 21  0  0 20     3
VecNorm               10 1.0 6.4931e-03 1.2 2.80e+02 1.0 0.0e+00 0.0e+00
1.0e+01 12  6  0  0 15  14  6  0  0 24     0
VecScale               9 1.0 2.5988e-05 1.3 1.26e+02 1.0 0.0e+00 0.0e+00
0.0e+00  0  3  0  0  0   0  3  0  0  0    19
VecCopy                1 1.0 3.0994e-06 1.4 0.00e+00 0.0 0.0e+00 0.0e+00
0.0e+00  0  0  0  0  0   0  0  0  0  0     0
VecSet                12 1.0 1.3113e-05 1.3 0.00e+00 0.0 0.0e+00 0.0e+00
0.0e+00  0  0  0  0  0   0  0  0  0  0     0
VecAXPY                2 1.0 2.2888e-05 1.8 5.60e+01 1.0 0.0e+00 0.0e+00
0.0e+00  0  1  0  0  0   0  1  0  0  0    10
VecMAXPY               9 1.0 2.2411e-05 1.9 1.23e+03 1.0 0.0e+00 0.0e+00
0.0e+00  0 27  0  0  0   0 27  0  0  0   220
VecScatterBegin        9 1.0 1.9288e-04 1.8 0.00e+00 0.0 5.4e+01 5.6e+01
0.0e+00  0  0 82 94  0   0  0100100  0     0
VecScatterEnd          9 1.0 9.6941e-04 2.3 0.00e+00 0.0 0.0e+00 0.0e+00
0.0e+00  1  0  0  0  0   2  0  0  0  0     0
VecNormalize           9 1.0 6.1085e-03 1.1 3.78e+02 1.0 0.0e+00 0.0e+00
9.0e+00 12  8  0  0 14  13  8  0  0 22     0
KSPGMRESOrthog         8 1.0 1.3480e-03 1.9 1.98e+03 1.0 0.0e+00 0.0e+00
8.0e+00  2 44  0  0 12   2 44  0  0 20     6
KSPSetup               2 1.0 2.0330e-03 1.3 0.00e+00 0.0 0.0e+00 0.0e+00
0.0e+00  4  0  0  0  0   4  0  0  0  0     0
KSPSolve               1 1.0 1.8885e-02 1.0 4.44e+03 1.0 4.8e+01 5.6e+01
3.5e+01 38 96 73 84 53  42 96 89 89 85     1
PCSetUp                2 1.0 5.5480e-03 1.2 7.60e+01 1.0 0.0e+00 0.0e+00
7.0e+00 10  2  0  0 11  11  2  0  0 17     0
PCSetUpOnBlocks        1 1.0 6.2799e-04 1.9 7.60e+01 1.0 0.0e+00 0.0e+00
5.0e+00  1  2  0  0  8   1  2  0  0 12     0
PCApply                9 1.0 2.3961e-04 1.1 8.10e+02 1.0 0.0e+00 0.0e+00
9.0e+00  0 18  0  0 14   1 18  0  0 22    14

--- Event Stage 1: Assembly

MatAssemblyBegin       1 1.0 3.8123e-04 1.7 0.00e+00 0.0 0.0e+00 0.0e+00
2.0e+00  1  0  0  0  3   5  0  0  0 17     0
MatAssemblyEnd         1 1.0 5.5060e-03 1.1 0.00e+00 0.0 1.2e+01 1.6e+01
1.0e+01 11  0 18  6 15  94  0100100 83     0
------------------------------------------------------------------------------------------------------------------------

Memory usage is given in bytes:

Object Type          Creations   Destructions   Memory  Descendants' Mem.

--- Event Stage 0: Main Stage

              Matrix     4              4      11408     0
                 Vec    20             21      29264     0
         Vec Scatter     0              1        868     0
           Index Set     3              3       1704     0
       Krylov Solver     2              2      18880     0
      Preconditioner     2              2       1408     0

--- Event Stage 1: Assembly

                 Vec     2              1       1304     0
         Vec Scatter     1              0          0     0
           Index Set     2              2       1052     0
========================================================================================================================


Why are there 4 matrices created/destroyed?  Where does this happen?  I only
see one matrix being created/destroyed in the source, so it must be
happening someplace in the KSP/PC.  Also, there is a mismatch in the Vec and
Vec Scatter counts in each of the stages, even though it would seem that
(e.g.) all the Vec Scatters should be contained to the assembly stage.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090825/625a6356/attachment.htm>


More information about the petsc-users mailing list