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:<br>
<br><span style="font-family: courier new,monospace;">Event Count Time (sec) Flops --- Global --- --- Stage --- Total</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Max Ratio Max Ratio Max Ratio Mess Avg len Reduct %T %F %M %L %R %T %F %M %L %R Mflop/s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">------------------------------------------------------------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- Event Stage 0: Main Stage</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- Event Stage 1: Assembly</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">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</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">------------------------------------------------------------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Memory usage is given in bytes:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Object Type Creations Destructions Memory Descendants' Mem.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--- Event Stage 0: Main Stage</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Matrix 4 4 11408 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Vec 20 21 29264 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Vec Scatter 0 1 868 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Index Set 3 3 1704 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Krylov Solver 2 2 18880 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Preconditioner 2 2 1408 0</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- Event Stage 1: Assembly</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Vec 2 1 1304 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Vec Scatter 1 0 0 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Index Set 2 2 1052 0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">========================================================================================================================</span><br style="font-family: courier new,monospace;">
<br><br>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.<br>
<br>John<br><br>