File: profiling.html

package info (click to toggle)
petsc 3.23.1%2Bdfsg1-1exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 515,576 kB
  • sloc: ansic: 751,607; cpp: 51,542; python: 38,598; f90: 17,352; javascript: 3,493; makefile: 3,157; sh: 1,502; xml: 619; objc: 445; java: 13; csh: 1
file content (1497 lines) | stat: -rw-r--r-- 121,369 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497

<!DOCTYPE html>


<html lang="en" data-content_root="../" >

  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>Profiling &#8212; PETSc 3.23.1 documentation</title>
  
  
  
  <script data-cfasync="false">
    document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
    document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
  </script>
  
  <!-- Loaded before other Sphinx assets -->
  <link href="../_static/styles/theme.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />

  
  <link href="../_static/vendor/fontawesome/6.5.1/css/all.min.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
  <link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2" />

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=8f2a1f02" />
    <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
    <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=87e54e7c" />
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.css" />
    <link rel="stylesheet" type="text/css" href="../_static/katex-math.css?v=91adb8b6" />
    <link rel="stylesheet" type="text/css" href="../_static/css/custom.css?v=dbe1606d" />
  
  <!-- Pre-loaded scripts that we'll load fully later -->
  <link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=bd9e20870c6007c4c509" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=bd9e20870c6007c4c509" />
  <script src="../_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=bd9e20870c6007c4c509"></script>

    <script src="../_static/documentation_options.js?v=34da53a5"></script>
    <script src="../_static/doctools.js?v=9a2dae69"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/clipboard.min.js?v=a7894cd8"></script>
    <script src="../_static/copybutton.js?v=a56c686a"></script>
    <script src="../_static/design-tabs.js?v=f930bc37"></script>
    <script src="../_static/katex.min.js?v=be8ff15f"></script>
    <script src="../_static/auto-render.min.js?v=ad136472"></script>
    <script src="../_static/katex_autorenderer.js?v=bebc588a"></script>
    <script>DOCUMENTATION_OPTIONS.pagename = 'manual/profiling';</script>
    <link rel="icon" href="../_static/petsc_favicon.png"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Hints for Performance Tuning" href="performance.html" />
    <link rel="prev" title="Using MATLAB with PETSc" href="matlab.html" />
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <meta name="docsearch:language" content="en"/>
    <meta name="docbuild:last-update" content="2025-04-30T13:10:40-0500 (v3.23.1)"/>
  </head>
  
  
  <body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">

  
  
  <a id="pst-skip-link" class="skip-link" href="#main-content">Skip to main content</a>
  
  <div id="pst-scroll-pixel-helper"></div>

  
  <button type="button" class="btn rounded-pill" id="pst-back-to-top">
    <i class="fa-solid fa-arrow-up"></i>
    Back to top
  </button>

  
  <input type="checkbox"
          class="sidebar-toggle"
          name="__primary"
          id="__primary"/>
  <label class="overlay overlay-primary" for="__primary"></label>
  
  <input type="checkbox"
          class="sidebar-toggle"
          name="__secondary"
          id="__secondary"/>
  <label class="overlay overlay-secondary" for="__secondary"></label>
  
  <div class="search-button__wrapper">
    <div class="search-button__overlay"></div>
    <div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
      action="../search.html"
      method="get">
  <i class="fa-solid fa-magnifying-glass"></i>
  <input type="search"
         class="form-control"
         name="q"
         id="search-input"
         placeholder="Search the docs ..."
         aria-label="Search the docs ..."
         autocomplete="off"
         autocorrect="off"
         autocapitalize="off"
         spellcheck="false"/>
  <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
  </div>

  <header>
  
    <div class="bd-header navbar navbar-expand-lg bd-navbar">
<div class="bd-header__inner bd-page-width">
  <label class="sidebar-toggle primary-toggle" for="__primary">
    <span class="fa-solid fa-bars"></span>
  </label>
  
  
  <div class="col-lg-3 navbar-header-items__start">
    
      <div class="navbar-item">

  

<a class="navbar-brand logo" href="../index.html">
  
  
  
  
  
    
    
      
    
    
    <img src="../_static/PETSc-TAO_RGB.svg" class="logo__image only-light" alt="PETSc 3.23.1 documentation - Home"/>
    <script>document.write(`<img src="../_static/PETSc-TAO_RGB_white.svg" class="logo__image only-dark" alt="PETSc 3.23.1 documentation - Home"/>`);</script>
  
  
</a></div>
    
  </div>
  
  <div class="col-lg-9 navbar-header-items">
    
    <div class="me-auto navbar-header-items__center">
      
        <div class="navbar-item">
<nav class="navbar-nav">
  <ul class="bd-navbar-elements navbar-nav">
    
                    <li class="nav-item current active">
                      <a class="nav-link nav-internal" href="../overview/index.html">
                        Overview
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../install/index.html">
                        Install
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../tutorials/index.html">
                        Tutorials
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="index.html">
                        User-Guide
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../manualpages/index.html">
                        C/Fortran API
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../petsc4py/index.html">
                        petsc4py API
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../faq/index.html">
                        FAQ
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../community/index.html">
                        Community
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../developers/index.html">
                        Developers
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../miscellaneous/index.html">
                        Misc.
                      </a>
                    </li>
                
  </ul>
</nav></div>
      
    </div>
    
    
    <div class="navbar-header-items__end">
      
        <div class="navbar-item navbar-persistent--container">
          

 <script>
 document.write(`
   <button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <i class="fa-solid fa-magnifying-glass"></i>
    <span class="search-button__default-text">Search</span>
    <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
   </button>
 `);
 </script>
        </div>
      
      
        <div class="navbar-item">

<script>
document.write(`
  <button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
  </button>
`);
</script></div>
      
        <div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
    aria-label="Icon Links">
        <li class="nav-item">
          
          
          
          
          
          
          
          
          <a href="https://gitlab.com/petsc/petsc" title="GitLab" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fab fa-gitlab fa-lg" aria-hidden="true"></i></span>
            <span class="sr-only">GitLab</span></a>
        </li>
</ul></div>
      
    </div>
    
  </div>
  
  
    <div class="navbar-persistent--mobile">

 <script>
 document.write(`
   <button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <i class="fa-solid fa-magnifying-glass"></i>
    <span class="search-button__default-text">Search</span>
    <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
   </button>
 `);
 </script>
    </div>
  

  
    <label class="sidebar-toggle secondary-toggle" for="__secondary" tabindex="0">
      <span class="fa-solid fa-outdent"></span>
    </label>
  
</div>

    </div>
  
  </header>

  <div class="bd-container">
    <div class="bd-container__inner bd-page-width">
      
      
      
      <div class="bd-sidebar-primary bd-sidebar">
        

  
  <div class="sidebar-header-items sidebar-primary__section">
    
    
      <div class="sidebar-header-items__center">
        
          <div class="navbar-item">
<nav class="navbar-nav">
  <ul class="bd-navbar-elements navbar-nav">
    
                    <li class="nav-item current active">
                      <a class="nav-link nav-internal" href="../overview/index.html">
                        Overview
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../install/index.html">
                        Install
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../tutorials/index.html">
                        Tutorials
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="index.html">
                        User-Guide
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../manualpages/index.html">
                        C/Fortran API
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../petsc4py/index.html">
                        petsc4py API
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../faq/index.html">
                        FAQ
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../community/index.html">
                        Community
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../developers/index.html">
                        Developers
                      </a>
                    </li>
                

                    <li class="nav-item">
                      <a class="nav-link nav-internal" href="../miscellaneous/index.html">
                        Misc.
                      </a>
                    </li>
                
  </ul>
</nav></div>
        
      </div>
    
    
    
      <div class="sidebar-header-items__end">
        
          <div class="navbar-item">

<script>
document.write(`
  <button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
  </button>
`);
</script></div>
        
          <div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
    aria-label="Icon Links">
        <li class="nav-item">
          
          
          
          
          
          
          
          
          <a href="https://gitlab.com/petsc/petsc" title="GitLab" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fab fa-gitlab fa-lg" aria-hidden="true"></i></span>
            <span class="sr-only">GitLab</span></a>
        </li>
</ul></div>
        
      </div>
    
  </div>
  
    <div class="sidebar-primary-items__start sidebar-primary__section">
        <div class="sidebar-primary-item">
<nav class="bd-docs-nav bd-links"
     aria-label="Section Navigation">
  <p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p>
  <div class="bd-toc-item navbar-nav"><ul class="current nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="../overview/nutshell.html">PETSc in a nutshell</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/features.html">Supported Systems</a></li>

<li class="toctree-l1"><a class="reference internal" href="../overview/gpu_roadmap.html">GPU Support Roadmap</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/vector_table.html">Summary of Vector Types Available In PETSc</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/matrix_table.html">Summary of Matrix Types Available In PETSc</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/linear_solve_table.html">Summary of Sparse Linear Solvers Available In PETSc</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/nonlinear_solve_table.html">Summary of Nonlinear Solvers Available In PETSc</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/integrator_table.html">Summary of Time Integrators Available In PETSc</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/tao_solve_table.html">Summary of Tao Solvers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/discrete_table.html">Summary of Discretization Management Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="../overview/plex_transform_table.html">Summary of Unstructured Mesh Transformations</a></li>
<li class="toctree-l1 current active has-children"><a class="reference internal" href="index.html">User-Guide</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-1"><i class="fa-solid fa-chevron-down"></i></label><ul class="current">
<li class="toctree-l2 has-children"><a class="reference internal" href="introduction.html">Introduction to PETSc</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-2"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="about_this_manual.html">About This Manual</a></li>
<li class="toctree-l3"><a class="reference internal" href="getting_started.html">Getting Started</a></li>






</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="programming.html">The Solvers in PETSc/TAO</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-3"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="vec.html">Vectors and Parallel Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="mat.html">Matrices</a></li>
<li class="toctree-l3"><a class="reference internal" href="ksp.html">KSP: Linear System Solvers</a></li>
<li class="toctree-l3"><a class="reference internal" href="snes.html">SNES: Nonlinear Solvers</a></li>
<li class="toctree-l3"><a class="reference internal" href="ts.html">TS: Scalable ODE and DAE Solvers</a></li>

<li class="toctree-l3"><a class="reference internal" href="tao.html">TAO: Optimization Solvers</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="dm.html">DM: Interfacing Between Solvers and Models/Discretizations</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-4"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="dmbase.html">DM Basics</a></li>
<li class="toctree-l3"><a class="reference internal" href="section.html">PetscSection: Connecting Grids to Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="dmplex.html">DMPlex: Unstructured Grids</a></li>
<li class="toctree-l3"><a class="reference internal" href="dmstag.html">DMSTAG: Staggered, Structured Grid</a></li>
<li class="toctree-l3"><a class="reference internal" href="dmnetwork.html">Networks</a></li>
<li class="toctree-l3"><a class="reference internal" href="dt.html">PetscDT: Discretization Technology in PETSc</a></li>
<li class="toctree-l3"><a class="reference internal" href="fe.html">PetscFE: Finite Element Infrastructure in PETSc</a></li>
</ul>
</li>
<li class="toctree-l2 current active has-children"><a class="reference internal" href="additional.html">Additional Information</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-5"><i class="fa-solid fa-chevron-down"></i></label><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="fortran.html">PETSc for Fortran Users</a></li>
<li class="toctree-l3"><a class="reference internal" href="versionchecking.html">Checking the PETSc version</a></li>
<li class="toctree-l3"><a class="reference internal" href="matlab.html">Using MATLAB with PETSc</a></li>
<li class="toctree-l3 current active"><a class="current reference internal" href="#">Profiling</a></li>
<li class="toctree-l3"><a class="reference internal" href="performance.html">Hints for Performance Tuning</a></li>
<li class="toctree-l3"><a class="reference internal" href="streams.html">STREAMS: Example Study</a></li>
<li class="toctree-l3"><a class="reference internal" href="blas-lapack.html">The Use of BLAS and LAPACK in PETSc and external libraries</a></li>
<li class="toctree-l3"><a class="reference internal" href="other.html">Other PETSc Features</a></li>

<li class="toctree-l3"><a class="reference internal" href="advanced.html">Advanced Features of Matrices and Solvers</a></li>
<li class="toctree-l3"><a class="reference internal" href="tests.html">Running PETSc Tests</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../manualpages/index.html">C/Fortran API</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-6"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Vector.html">Vectors and Index Sets</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-7"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Vec/index.html">Vector Operations (Vec)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/IS/index.html">Index sets (IS)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Matrix.html">Matrices and Matrix Operations</a><input class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-8"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Mat/index.html">Matrix Operations (Mat)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/MatGraphOperations/index.html">Matrix colorings (MatColoring), orderings (MatOrdering), partitionings (MatPartitioning), and coarsening (MatCoarsen)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/MatFD/index.html">Finite difference computation of Jacobians (MatFD)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/DataLayout.html">Data Layout and Communication</a><input class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-9"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/PetscSF/index.html">Star Forest Communication (PetscSF)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/PetscSection/index.html">Section Data Layout (PetscSection)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/AO/index.html">Application Orderings (AO)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/DataManagement.html">Data Management between Vec and Mat, and Distributed Mesh Data Structures</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-10"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DM/index.html">Data Management (DM)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMDA/index.html">Structured Grids (DMDA)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMStag/index.html">Staggered, Structured Grids (DMSTAG)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMPlex/index.html">Unstructured Grids and Cell Complexes (DMPLEX)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMNetwork/index.html">Graphs and Networks (DMNETWORK)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMForest/index.html">A Forest of Trees and Structured Adaptive Refinement (DMFOREST)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMPatch/index.html">Sequences of parallel mesh patches (DMPATCH)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMSwarm/index.html">Particle Discretizations (DMSWARM)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMMOAB/index.html">MOAB Mesh Representation (DMMOAB)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMLabel/index.html">Selecting Parts of Meshes (DMLabel)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMPRODUCT/index.html">Tensor products of meshes (DMRODUCT)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DMComposite/index.html">DMComposite</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Discretization.html">Discretization and Function Spaces</a><input class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-11"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DT/index.html">Discretization Technology and Quadrature (DT)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/SPACE/index.html">Function Spaces (PetscSpace)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/DUALSPACE/index.html">Dual Spaces (PetscDualSpace)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/FE/index.html">Finite Elements (PetscFE)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/FV/index.html">Finite Volumes (PetscFV)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/PF/index.html">Defining your own mathematical functions (PF)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/LANDAU/index.html">Landau Collision Operator</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/LinearSolvers.html">Linear Solvers and Preconditioners</a><input class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-12"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/KSP/index.html">Linear Solvers and Krylov Methods (KSP)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/PC/index.html">Preconditioners (PC)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/NonlinearSolvers.html">Nonlinear Solvers</a><input class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-13"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/SNES/index.html">Nonlinear Solvers (SNES)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/SNESFAS/index.html">Full Approximation Scheme (FAS) nonlinear multigrid</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Timestepping.html">Forward and Adjoint Timestepping</a><input class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-14"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/TS/index.html">Time Stepping ODE and DAE Solvers (TS)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Sensitivity/index.html">Sensitivity Analysis for ODE and DAE</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Characteristic/index.html">Semi-Lagrangian Solves using the Method of Characteristics</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Optimization.html">Optimization</a><input class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-15"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Tao/index.html">Optimization Solvers (Tao)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/TaoLineSearch/index.html">Optimization Line Search (TaoLineSearch)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/Visualization.html">Graphics and Visualization</a><input class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-16"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Draw/index.html">Graphics (Draw)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Viewer/index.html">Viewing Objects (Viewer)</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../manualpages/System.html">System Routines, Profiling, Data Structures</a><input class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-17"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Sys/index.html">PETSc Options, IO, and System Utilities</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/PetscH/index.html">Hash Tables</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Log/index.html">Profiling and Logging</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Device/index.html">Device</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Matlab/index.html">Matlab</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/Bag/index.html">Bag</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manualpages/BM/index.html">Benchmarks (BM)</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../changes/index.html">Changes for each release</a></li>
<li class="toctree-l2"><a class="reference internal" href="../manualpages/singleindex.html">Single Index of all PETSc Manual Pages</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../changes/index.html">Changes for each release</a></li>
<li class="toctree-l1"><a class="reference internal" href="../manualpages/singleindex.html">Single Index of all PETSc Manual Pages</a></li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../overview/previous_release_docs.html">Documentation for previous PETSc releases</a><input class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-18"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.22/docs"> 3.22</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.21/docs"> 3.21</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.20/docs"> 3.20</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.19/docs"> 3.19</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.18/docs"> 3.18</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.17/docs"> 3.17</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.16/docs"> 3.16</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.15/docs"> 3.15</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.14/docs"> 3.14</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.13/docs"> 3.13</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.12/docs"> 3.12</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.11/docs"> 3.11</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.10/docs"> 3.10</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.9/docs"> 3.9</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.8/docs"> 3.8</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.7/docs"> 3.7</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.6/docs"> 3.6</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.5/docs"> 3.5</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.4/docs"> 3.4</a></li>
<li class="toctree-l2"><a class="reference external" href="https://web.cels.anl.gov/projects/petsc/vault/petsc-3.3/docs"> 3.3</a></li>
</ul>
</li>
</ul>
</div>
</nav></div>
    </div>
  
  
  <div class="sidebar-primary-items__end sidebar-primary__section">
  </div>
  
  <div id="rtd-footer-container"></div>


      </div>
      
      <main id="main-content" class="bd-main">
        
        
          <div class="bd-content">
            <div class="bd-article-container">
              
              <div class="bd-header-article">
<div class="header-article-items header-article__inner">
  
    <div class="header-article-items__start">
      
        <div class="header-article-item">





<nav aria-label="Breadcrumb">
  <ul class="bd-breadcrumbs">
    
    <li class="breadcrumb-item breadcrumb-home">
      <a href="../index.html" class="nav-link" aria-label="Home">
        <i class="fa-solid fa-home"></i>
      </a>
    </li>
    
    <li class="breadcrumb-item"><a href="../overview/index.html" class="nav-link">Overview</a></li>
    
    
    <li class="breadcrumb-item"><i class="fa-solid fa-ellipsis"></i></li>
    
    
    <li class="breadcrumb-item"><a href="additional.html" class="nav-link">Additional Information</a></li>
    
    <li class="breadcrumb-item active" aria-current="page">Profiling</li>
  </ul>
</nav>
</div>
      
    </div>
  
  
</div>
</div>
              
              
              
                
<div id="searchbox"></div>
                <article class="bd-article">
                  
  <section class="tex2jax_ignore mathjax_ignore" id="profiling">
<span id="ch-profiling"></span><h1>Profiling<a class="headerlink" href="#profiling" title="Link to this heading">#</a></h1>
<p>PETSc includes a consistent, lightweight scheme for profiling
application programs. The PETSc routines automatically log
performance data if certain options are specified at runtime. The user
can also log information about application codes for a complete picture
of performance.</p>
<p>In addition, as described in
<a class="reference internal" href="#sec-ploginfo"><span class="std std-ref">Interpreting -log_view Output: The Basics</span></a>, PETSc provides a mechanism for
printing informative messages about computations.
<a class="reference internal" href="#sec-profbasic"><span class="std std-ref">Basic Profiling Information</span></a> introduces the various profiling
options in PETSc, while the remainder of the chapter focuses on details
such as monitoring application codes and tips for accurate profiling.</p>
<section id="basic-profiling-information">
<span id="sec-profbasic"></span><h2>Basic Profiling Information<a class="headerlink" href="#basic-profiling-information" title="Link to this heading">#</a></h2>
<p>The profiling options include the following:</p>
<ul class="simple">
<li><p><code class="docutils notranslate"><span class="pre">-log_view</span>&#160; <span class="pre">[:filename]</span></code> - Prints an ASCII version of performance data at the
program’s conclusion. These statistics are comprehensive and concise
and require little overhead; thus, <code class="docutils notranslate"><span class="pre">-log_view</span></code> is intended as the
primary means of monitoring the performance of PETSc codes. See <a class="reference internal" href="#sec-ploginfo"><span class="std std-ref">Interpreting -log_view Output: The Basics</span></a></p></li>
<li><p><code class="docutils notranslate"><span class="pre">-info</span> <span class="pre">[infofile]</span></code> - Prints verbose information about code to
stdout or an optional file. This option provides details about
algorithms, data structures, etc. Since the overhead of printing such
output slows a code, this option should not be used when evaluating a
program’s performance. See <a class="reference internal" href="#sec-petscinfo"><span class="std std-ref">Interpreting -info Output: Informative Messages</span></a></p></li>
<li><p><code class="docutils notranslate"><span class="pre">-log_trace</span> <span class="pre">[logfile]</span></code> - Traces the beginning and ending of all
PETSc events. This option, which can be used in conjunction with
<code class="docutils notranslate"><span class="pre">-info</span></code>, is useful to see where a program is hanging without
running in the debugger. See <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogTraceBegin.html">PetscLogTraceBegin</a>()</span></code>.</p></li>
</ul>
<p>As discussed in <a class="reference internal" href="#sec-mpelogs"><span class="std std-ref">Using -log_mpe with Jumpshot</span></a>, additional profiling
can be done with MPE.</p>
<section id="interpreting-log-view-output-the-basics">
<span id="sec-ploginfo"></span><h3>Interpreting <code class="docutils notranslate"><span class="pre">-log_view</span></code> Output: The Basics<a class="headerlink" href="#interpreting-log-view-output-the-basics" title="Link to this heading">#</a></h3>
<p>As shown in <a class="reference internal" href="getting_started.html#listing-exprof"><span class="std std-ref">listing</span></a> in <a class="reference internal" href="getting_started.html#sec-profiling-programs"><span class="std std-ref">Profiling Programs</span></a>, the
option <code class="docutils notranslate"><span class="pre">-log_view</span></code> <code class="docutils notranslate"><span class="pre">[:filename]</span></code> activates printing of profile data to standard
output or an ASCII file at the conclusion of a program. See <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogView.html">PetscLogView</a>()</span></code> for all the possible
output options.</p>
<p>We print performance data for each routine, organized by PETSc
libraries, followed by any user-defined events (discussed in
<a class="reference internal" href="#sec-profileuser"><span class="std std-ref">Profiling Application Codes</span></a>). For each routine, the output data
include the maximum time and floating point operation (flop) rate over
all processes. Information about parallel performance is also included,
as discussed in the following section.</p>
<p>For the purpose of PETSc floating point operation counting, we define
one <em>flop</em> as one operation of any of the following types:
multiplication, division, addition, or subtraction. For example, one
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecAXPY.html">VecAXPY</a>()</span></code> operation, which computes <span class="math">\(y = \alpha x + y\)</span> for
vectors of length <span class="math">\(N\)</span>, requires <span class="math">\(2N\)</span> flop (consisting of
<span class="math">\(N\)</span> additions and <span class="math">\(N\)</span> multiplications). Bear in mind that
flop rates present only a limited view of performance, since memory
loads and stores are the real performance barrier.</p>
<p>For simplicity, the remainder of this discussion focuses on interpreting
profile data for the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> library, which provides the linear solvers
at the heart of the PETSc package. Recall the hierarchical organization
of the PETSc library, as shown in
<a class="reference internal" href="getting_started.html#fig-library"><span class="std std-ref">Numerical Libraries in PETSc</span></a>. Each <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> solver is composed
of a <code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PC.html">PC</a></span></code> (preconditioner) and a <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> (Krylov subspace) part, which
are in turn built on top of the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/Mat.html">Mat</a></span></code> (matrix) and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/Vec.html">Vec</a></span></code> (vector)
modules. Thus, operations in the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> module are composed of
lower-level operations in these packages. Note also that the nonlinear
solvers library, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/SNES/SNES.html">SNES</a></span></code>, is built on top of the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> module, and
the timestepping library, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/TS/TS.html">TS</a></span></code>, is in turn built on top of <code class="docutils notranslate"><span class="pre"><a href="../manualpages/SNES/SNES.html">SNES</a></span></code>.</p>
<p>We briefly discuss interpretation of the sample output in
<a class="reference internal" href="getting_started.html#listing-exprof"><span class="std std-ref">listing</span></a>, which was generated by solving a
linear system on one process using restarted GMRES and ILU
preconditioning. The linear solvers in <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> consist of two basic
phases, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a>()</span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a>()</span></code>, each of which consists of a
variety of actions, depending on the particular solution technique. For
the case of using the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PCILU.html">PCILU</a></span></code> preconditioner and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPGMRES.html">KSPGMRES</a></span></code> Krylov
subspace method, the breakdown of PETSc routines is listed below. As
indicated by the levels of indentation, the operations in <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a>()</span></code>
include all of the operations within <code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PCSetUp.html">PCSetUp</a>()</span></code>, which in turn
include <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatILUFactor.html">MatILUFactor</a>()</span></code>, and so on.</p>
<ul class="simple">
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a></span></code> - Set up linear solver</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PCSetUp.html">PCSetUp</a></span></code> - Set up preconditioner</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatILUFactor.html">MatILUFactor</a></span></code> - Factor preconditioning matrix</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatILUFactorSymbolic.html">MatILUFactorSymbolic</a></span></code> - Symbolic factorization phase</p></li>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatLUFactorNumeric.html">MatLUFactorNumeric</a></span></code> - Numeric factorization phase</p></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a></span></code> - Solve linear system</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PCApply.html">PCApply</a></span></code> - Apply preconditioner</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatSolve.html">MatSolve</a></span></code> - Forward/backward triangular solves</p></li>
</ul>
</li>
<li><p><code class="docutils notranslate"><span class="pre">KSPGMRESOrthog</span></code> - Orthogonalization in GMRES</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecDot.html">VecDot</a></span></code> or <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecMDot.html">VecMDot</a></span></code> - Inner products</p></li>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecAXPY.html">VecAXPY</a></span></code> or <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecMAXPY.html">VecMAXPY</a></span></code> - vector updates</p></li>
</ul>
</li>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatMult.html">MatMult</a></span></code> - Matrix-vector product</p></li>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatMultAdd.html">MatMultAdd</a></span></code> - Matrix-vector product + vector addition</p>
<ul>
<li><p><code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecScale.html">VecScale</a></span></code>, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecNorm.html">VecNorm</a></span></code>, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecAXPY.html">VecAXPY</a></span></code>, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecCopy.html">VecCopy</a></span></code>, …</p></li>
</ul>
</li>
</ul>
</li>
</ul>
<p>The summaries printed via <code class="docutils notranslate"><span class="pre">-log_view</span></code> reflect this routine hierarchy.
For example, the performance summaries for a particular high-level
routine such as <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a>()</span></code> include all of the operations accumulated
in the lower-level components that make up the routine.</p>
<p>The output produced with <code class="docutils notranslate"><span class="pre">-log_view</span></code> is flat, meaning that the hierarchy
of PETSc operations is not completely clear. For a
particular problem, the user should generally have an idea of the basic
operations that are required for its implementation (e.g., which
operations are performed when using GMRES and ILU, as described above),
so that interpreting the <code class="docutils notranslate"><span class="pre">-log_view</span></code> data should be relatively
straightforward.
If this is problematic then it is also possible to examine
the profiling information in a nested format. For more information see
<a class="reference internal" href="#sec-nestedevents"><span class="std std-ref">Profiling Nested Events</span></a>.</p>
</section>
<section id="interpreting-log-view-output-parallel-performance">
<span id="sec-parperformance"></span><h3>Interpreting <code class="docutils notranslate"><span class="pre">-log_view</span></code> Output: Parallel Performance<a class="headerlink" href="#interpreting-log-view-output-parallel-performance" title="Link to this heading">#</a></h3>
<p>We next discuss performance summaries for parallel programs, as shown
within <a class="reference internal" href="#listing-exparprof"><span class="std std-ref">listing</span></a> and <a class="reference internal" href="#listing-exparprof2"><span class="std std-ref">listing</span></a>,
which presents the
output generated by the <code class="docutils notranslate"><span class="pre">-log_view</span></code> option. The program that generated
this data is
<a href="../src/ksp/ksp/tutorials/ex10.c.html">KSP Tutorial ex10</a>.
The code loads a matrix and right-hand-side vector from a binary file
and then solves the resulting linear system; the program then repeats
this process for a second linear system. This particular case was run on
four processors of an Intel x86_64 Linux cluster, using restarted GMRES
and the block Jacobi preconditioner, where each block was solved with
ILU. The two input files <code class="docutils notranslate"><span class="pre">medium</span></code> and <code class="docutils notranslate"><span class="pre">arco6</span></code> can be obtained from
<a class="reference external" href="https://gitlab.com/petsc/datafiles">datafiles</a>, see <a class="reference internal" href="../developers/documentation.html#petsc-repositories"><span class="std std-ref">Other PETSc repositories</span></a>.</p>
<p>The first <a class="reference internal" href="#listing-exparprof"><span class="std std-ref">listing</span></a> presents an overall
performance summary, including times, floating-point operations,
computational rates, and message-passing activity (such as the number
and size of messages sent and collective operations). Summaries for
various user-defined stages of monitoring (as discussed in
<a class="reference internal" href="#sec-profstages"><span class="std std-ref">Profiling Multiple Sections of Code</span></a>) are also given. Information about the
various phases of computation then follow (as shown separately here in
the second <a class="reference internal" href="#listing-exparprof2"><span class="std std-ref">listing</span></a>). Finally, a summary of
object creation and destruction is presented.</p>
<div class="highlight-none notranslate" id="listing-exparprof"><div class="highlight"><pre><span></span>mpiexec -n 4 ./ex10 -f0 medium -f1 arco6 -ksp_gmres_classicalgramschmidt -log_view -mat_type baij \
            -matload_block_size 3 -pc_type bjacobi -options_left

Number of iterations = 19
Residual norm 1.088292e-05
Number of iterations = 59
Residual norm 3.871022e-02
---------------------------------------------- PETSc Performance Summary: ----------------------------------------------

./ex10 on a intel-bdw-opt named beboplogin4 with 4 processors, by jczhang Mon Apr 23 13:36:54 2018
Using PETSc Development Git Revision: v3.9-163-gbe3efd42 Git Date: 2018-04-16 10:45:40 -0500

                         Max       Max/Min        Avg      Total
Time (sec):           1.849e-01      1.00002   1.849e-01
Objects:              1.060e+02      1.00000   1.060e+02
Flops:                2.361e+08      1.00684   2.353e+08  9.413e+08
Flops/sec:            1.277e+09      1.00685   1.273e+09  5.091e+09
MPI Msg Count:        2.360e+02      1.34857   2.061e+02  8.245e+02
MPI Msg Len (bytes):  1.256e+07      2.24620   4.071e+04  3.357e+07
MPI Reductions:       2.160e+02      1.00000

Summary of Stages:   ----- Time ------  ----- Flop -----  --- Messages ---  -- Message Lengths --  -- Reductions --
                        Avg     %Total     Avg     %Total   counts   %Total     Avg         %Total   counts   %Total
 0:      Main Stage: 5.9897e-04   0.3%  0.0000e+00   0.0%  0.000e+00   0.0%  0.000e+00        0.0%  2.000e+00   0.9%
 1:   Load System 0: 2.9113e-03   1.6%  0.0000e+00   0.0%  3.550e+01   4.3%  5.984e+02        0.1%  2.200e+01  10.2%
 2:      <a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a> 0: 7.7349e-04   0.4%  9.9360e+03   0.0%  0.000e+00   0.0%  0.000e+00        0.0%  2.000e+00   0.9%
 3:      <a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a> 0: 1.7690e-03   1.0%  2.9673e+05   0.0%  1.520e+02  18.4%  1.800e+02        0.1%  3.900e+01  18.1%
 4:   Load System 1: 1.0056e-01  54.4%  0.0000e+00   0.0%  3.700e+01   4.5%  5.657e+05       62.4%  2.200e+01  10.2%
 5:      <a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a> 1: 5.6883e-03   3.1%  2.1205e+07   2.3%  0.000e+00   0.0%  0.000e+00        0.0%  2.000e+00   0.9%
 6:      <a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a> 1: 7.2578e-02  39.3%  9.1979e+08  97.7%  6.000e+02  72.8%  2.098e+04       37.5%  1.200e+02  55.6%

------------------------------------------------------------------------------------------------------------------------

.... [Summary of various phases, see part II below] ...

------------------------------------------------------------------------------------------------------------------------

Object Type          Creations   Destructions    (Reports information only for process 0.)
...
--- Event Stage 3: <a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a> 0

              Matrix     0              4
              Vector    20             30
           Index Set     0              3
         <a href="../manualpages/Vec/Vec.html">Vec</a> Scatter     0              1
       Krylov Solver     0              2
      Preconditioner     0              2
</pre></div>
</div>
<p>We next focus on the summaries for the various phases of the
computation, as given in the table within
the following <a class="reference internal" href="#listing-exparprof2"><span class="std std-ref">listing</span></a>. The summary for each
phase presents the maximum times and flop rates over all processes, as
well as the ratio of maximum to minimum times and flop rates for all
processes. A ratio of approximately 1 indicates that computations within
a given phase are well balanced among the processes; as the ratio
increases, the balance becomes increasingly poor. Also, the total
computational rate (in units of MFlop/sec) is given for each phase in
the final column of the phase summary table.</p>
<div class="math">
\[
{\rm Total\: Mflop/sec} \:=\: 10^{-6} * ({\rm sum\; of\; flop\; over\; all\; processors})/({\rm max\; time\; over\; all\; processors})
\]</div>
<p><em>Note</em>: Total computational rates <span class="math">\(&lt;\)</span> 1 MFlop are listed as 0 in
this column of the phase summary table. Additional statistics for each
phase include the total number of messages sent, the average message
length, and the number of global reductions.</p>
<div class="highlight-none notranslate" id="listing-exparprof2"><div class="highlight"><pre><span></span>mpiexec -n 4 ./ex10 -f0 medium -f1 arco6 -ksp_gmres_classicalgramschmidt -log_view -mat_type baij \
            -matload_block_size 3 -pc_type bjacobi -options_left

---------------------------------------------- PETSc Performance Summary: ----------------------------------------------
.... [Overall summary, see part I] ...

Phase summary info:
   Count: number of times phase was executed
   Time and Flop/sec: Max - maximum over all processors
                       Ratio - ratio of maximum to minimum over all processors
   Mess: number of messages sent
   AvgLen: average message length
   Reduct: number of global reductions
   Global: entire computation
   Stage: optional user-defined stages of a computation. Set stages with <a href="../manualpages/Log/PetscLogStagePush.html">PetscLogStagePush</a>() and <a href="../manualpages/Log/PetscLogStagePop.html">PetscLogStagePop</a>().
      %T - percent time in this phase         %F - percent flop in this phase
      %M - percent messages in this phase     %L - percent message lengths in this phase
      %R - percent reductions in this phase
   Total Mflop/s: 10^6 * (sum of flop over all processors)/(max time over all processors)
------------------------------------------------------------------------------------------------------------------------
Phase              Count      Time (sec)       Flop/sec                          --- Global ---  --- Stage ----  Total
                            Max    Ratio      Max    Ratio  Mess AvgLen  Reduct  %T %F %M %L %R  %T %F %M %L %R Mflop/s
------------------------------------------------------------------------------------------------------------------------
...

--- Event Stage 5: <a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a> 1

MatLUFactorNum         1 1.0 3.6440e-03 1.1 5.30e+06 1.0 0.0e+00 0.0e+00 0.0e+00  2  2  0  0  0  62100  0  0  0  5819
MatILUFactorSym        1 1.0 1.7111e-03 1.4 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00  1  0  0  0  0  26  0  0  0  0     0
<a href="../manualpages/Mat/MatGetRowIJ.html">MatGetRowIJ</a>            1 1.0 1.1921e-06 1.2 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
<a href="../manualpages/MatGraphOperations/MatGetOrdering.html">MatGetOrdering</a>         1 1.0 3.0041e-05 1.1 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00  0  0  0  0  0   1  0  0  0  0     0
<a href="../manualpages/KSP/KSPSetUp.html">KSPSetUp</a>               2 1.0 6.6495e-04 1.5 0.00e+00 0.0 0.0e+00 0.0e+00 2.0e+00  0  0  0  0  1   9  0  0  0100     0
<a href="../manualpages/PC/PCSetUp.html">PCSetUp</a>                2 1.0 5.4271e-03 1.2 5.30e+06 1.0 0.0e+00 0.0e+00 0.0e+00  3  2  0  0  0  90100  0  0  0  3907
<a href="../manualpages/PC/PCSetUpOnBlocks.html">PCSetUpOnBlocks</a>        1 1.0 5.3999e-03 1.2 5.30e+06 1.0 0.0e+00 0.0e+00 0.0e+00  3  2  0  0  0  90100  0  0  0  3927

--- Event Stage 6: <a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a> 1

<a href="../manualpages/Mat/MatMult.html">MatMult</a>               60 1.0 2.4068e-02 1.1 6.54e+07 1.0 6.0e+02 2.1e+04 0.0e+00 12 27 73 37  0  32 28100100  0 10731
<a href="../manualpages/Mat/MatSolve.html">MatSolve</a>              61 1.0 1.9177e-02 1.0 5.99e+07 1.0 0.0e+00 0.0e+00 0.0e+00 10 25  0  0  0  26 26  0  0  0 12491
<a href="../manualpages/Vec/VecMDot.html">VecMDot</a>               59 1.0 1.4741e-02 1.3 4.86e+07 1.0 0.0e+00 0.0e+00 5.9e+01  7 21  0  0 27  18 21  0  0 49 13189
<a href="../manualpages/Vec/VecNorm.html">VecNorm</a>               61 1.0 3.0417e-03 1.4 3.29e+06 1.0 0.0e+00 0.0e+00 6.1e+01  1  1  0  0 28   4  1  0  0 51  4332
<a href="../manualpages/Vec/VecScale.html">VecScale</a>              61 1.0 9.9802e-04 1.0 1.65e+06 1.0 0.0e+00 0.0e+00 0.0e+00  1  1  0  0  0   1  1  0  0  0  6602
<a href="../manualpages/Vec/VecCopy.html">VecCopy</a>                2 1.0 5.9128e-05 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
<a href="../manualpages/Vec/VecSet.html">VecSet</a>                64 1.0 8.0323e-04 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00  0  0  0  0  0   1  0  0  0  0     0
<a href="../manualpages/Vec/VecAXPY.html">VecAXPY</a>                3 1.0 7.4387e-05 1.1 1.62e+05 1.0 0.0e+00 0.0e+00 0.0e+00  0  0  0  0  0   0  0  0  0  0  8712
<a href="../manualpages/Vec/VecMAXPY.html">VecMAXPY</a>              61 1.0 8.8558e-03 1.1 5.18e+07 1.0 0.0e+00 0.0e+00 0.0e+00  5 22  0  0  0  12 23  0  0  0 23393
<a href="../manualpages/Vec/VecScatterBegin.html">VecScatterBegin</a>       60 1.0 9.6416e-04 1.8 0.00e+00 0.0 6.0e+02 2.1e+04 0.0e+00  0  0 73 37  0   1  0100100  0     0
<a href="../manualpages/Vec/VecScatterEnd.html">VecScatterEnd</a>         60 1.0 6.1543e-03 1.2 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00  3  0  0  0  0   8  0  0  0  0     0
<a href="../manualpages/Vec/VecNormalize.html">VecNormalize</a>          61 1.0 4.2675e-03 1.3 4.94e+06 1.0 0.0e+00 0.0e+00 6.1e+01  2  2  0  0 28   5  2  0  0 51  4632
KSPGMRESOrthog        59 1.0 2.2627e-02 1.1 9.72e+07 1.0 0.0e+00 0.0e+00 5.9e+01 11 41  0  0 27  29 42  0  0 49 17185
<a href="../manualpages/KSP/KSPSolve.html">KSPSolve</a>               1 1.0 7.2577e-02 1.0 2.31e+08 1.0 6.0e+02 2.1e+04 1.2e+02 39 98 73 37 56  99100100100100 12673
<a href="../manualpages/PC/PCSetUpOnBlocks.html">PCSetUpOnBlocks</a>        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
<a href="../manualpages/PC/PCApply.html">PCApply</a>               61 1.0 2.0427e-02 1.0 5.99e+07 1.0 0.0e+00 0.0e+00 0.0e+00 11 25  0  0  0  28 26  0  0  0 11726
------------------------------------------------------------------------------------------------------------------------
.... [Conclusion of overall summary, see part I] ...
</pre></div>
</div>
<p>As discussed in the preceding section, the performance summaries for
higher-level PETSc routines include the statistics for the lower levels
of which they are made up. For example, the communication within
matrix-vector products <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/MatMult.html">MatMult</a>()</span></code> consists of vector scatter
operations, as given by the routines <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecScatterBegin.html">VecScatterBegin</a>()</span></code> and
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/VecScatterEnd.html">VecScatterEnd</a>()</span></code>.</p>
<p>The final data presented are the percentages of the various statistics
(time (<code class="docutils notranslate"><span class="pre">%T</span></code>), flop/sec (<code class="docutils notranslate"><span class="pre">%F</span></code>), messages(<code class="docutils notranslate"><span class="pre">%M</span></code>), average message
length (<code class="docutils notranslate"><span class="pre">%L</span></code>), and reductions (<code class="docutils notranslate"><span class="pre">%R</span></code>)) for each event relative to the
total computation and to any user-defined stages (discussed in
<a class="reference internal" href="#sec-profstages"><span class="std std-ref">Profiling Multiple Sections of Code</span></a>). These statistics can aid in
optimizing performance, since they indicate the sections of code that
could benefit from various kinds of tuning.
<a class="reference internal" href="performance.html#ch-performance"><span class="std std-ref">Hints for Performance Tuning</span></a> gives suggestions about achieving good
performance with PETSc codes.</p>
<p>The additional option <code class="docutils notranslate"><span class="pre">-log_view_memory</span></code> causes the display of additional columns of information about how much
memory was allocated and freed during each logged event. This is useful
to understand what phases of a computation require the most memory.</p>
</section>
<section id="using-log-mpe-with-jumpshot">
<span id="sec-mpelogs"></span><h3>Using <code class="docutils notranslate"><span class="pre">-log_mpe</span></code> with Jumpshot<a class="headerlink" href="#using-log-mpe-with-jumpshot" title="Link to this heading">#</a></h3>
<p>It is also possible to use the <em>Jumpshot</em> package
<span id="id1">[<a class="reference internal" href="#id1198" title="Virginia Herrarte and Ewing Lusk. Studying parallel program behavior with Upshot. Technical Report ANL-91/15, Argonne National Laboratory, August 1991.">HL91</a>]</span> to visualize PETSc events. This package comes
with the MPE software, which is part of the MPICH
<span id="id2">[<a class="reference internal" href="#id1189" title="William Gropp and et. al. MPICH Web page. http://www.mpich.org. URL: http://www.mpich.org.">Getal</a>]</span> implementation of MPI. The option</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>-log_mpe [logfile]
</pre></div>
</div>
<p>creates a logfile of events appropriate for viewing with <em>Jumpshot</em>. The
user can either use the default logging file or specify a name via
<code class="docutils notranslate"><span class="pre">logfile</span></code>. Events can be deactivated as described in
<a class="reference internal" href="#sec-deactivate"><span class="std std-ref">Restricting Event Logging</span></a>.</p>
<p>The user can also log MPI events. To do this, simply consider the PETSc
application as any MPI application, and follow the MPI implementation’s
instructions for logging MPI calls. For example, when using MPICH, this
merely required adding <code class="docutils notranslate"><span class="pre">-llmpich</span></code> to the library list <em>before</em>
<code class="docutils notranslate"><span class="pre">-lmpich</span></code>.</p>
</section>
<section id="profiling-nested-events">
<span id="sec-nestedevents"></span><h3>Profiling Nested Events<a class="headerlink" href="#profiling-nested-events" title="Link to this heading">#</a></h3>
<p>It is possible to output the PETSc logging information in a nested format
where the hierarchy of events is explicit. This output can be generated
either as an XML file or as a text file in a format suitable for viewing as
a flame graph.</p>
<p>One can generate the XML output by passing the option <code class="docutils notranslate"><span class="pre">-log_view</span> <span class="pre">:[logfilename]:ascii_xml</span></code>.
It can be viewed by copying <code class="docutils notranslate"><span class="pre">${PETSC_DIR}/share/petsc/xml/performance_xml2html.xsl</span></code>
into the current directory, then opening the logfile in your browser.</p>
<p>The flame graph output can be generated with the option <code class="docutils notranslate"><span class="pre">-log_view</span> <span class="pre">:[logfile]:ascii_flamegraph</span></code>.
It can then be visualised with either <a class="reference external" href="https://github.com/brendangregg/FlameGraph">FlameGraph</a>
or <a class="reference external" href="https://www.speedscope.app">speedscope</a>. A flamegraph can be visualized directly from
stdout using, for example,
<code class="docutils notranslate"><span class="pre">ImageMagick's</span> <span class="pre">display</span> <span class="pre">utility</span> <span class="pre">&lt;https://imagemagick.org/script/display.php&gt;</span></code>:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span><span class="w"> </span><span class="n">$PETSC_DIR</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">tests</span>
<span class="n">make</span><span class="w"> </span><span class="n">ex30</span>
<span class="n">mpiexec</span><span class="w"> </span><span class="o">-</span><span class="n">n</span><span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="p">.</span><span class="o">/</span><span class="n">ex30</span><span class="w"> </span><span class="o">-</span><span class="n">log_view</span><span class="w"> </span><span class="o">::</span><span class="n">ascii_flamegraph</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">flamegraph</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">display</span>
</pre></div>
</div>
<p>Note that user-defined stages (see <a class="reference internal" href="#sec-profstages"><span class="std std-ref">Profiling Multiple Sections of Code</span></a>) will be ignored when
using this nested format.</p>
</section>
</section>
<section id="profiling-application-codes">
<span id="sec-profileuser"></span><h2>Profiling Application Codes<a class="headerlink" href="#profiling-application-codes" title="Link to this heading">#</a></h2>
<p>PETSc automatically logs object creation, times, and floating-point
counts for the library routines. Users can easily supplement this
information by profiling their application codes as well. The basic
steps involved in logging a user-defined portion of code, called an
<em>event</em>, are shown in the code fragment below:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEvent.html">PetscLogEvent</a></span><span class="w">  </span><span class="n">USER_EVENT</span><span class="p">;</span>
<span class="n"><a href="../manualpages/Sys/PetscClassId.html">PetscClassId</a></span><span class="w">   </span><span class="n">classid</span><span class="p">;</span>
<span class="n"><a href="../manualpages/Sys/PetscLogDouble.html">PetscLogDouble</a></span><span class="w"> </span><span class="n">user_event_flops</span><span class="p">;</span>

<span class="n"><a href="../manualpages/Log/PetscClassIdRegister.html">PetscClassIdRegister</a></span><span class="p">(</span><span class="s">&quot;class name&quot;</span><span class="p">,</span><span class="o">&amp;</span><span class="n">classid</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventRegister.html">PetscLogEventRegister</a></span><span class="p">(</span><span class="s">&quot;User event name&quot;</span><span class="p">,</span><span class="n">classid</span><span class="p">,</span><span class="o">&amp;</span><span class="n">USER_EVENT</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventBegin.html">PetscLogEventBegin</a></span><span class="p">(</span><span class="n">USER_EVENT</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span>
<span class="cm">/* code segment to monitor */</span>
<span class="n"><a href="../manualpages/Log/PetscLogFlops.html">PetscLogFlops</a></span><span class="p">(</span><span class="n">user_event_flops</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventEnd.html">PetscLogEventEnd</a></span><span class="p">(</span><span class="n">USER_EVENT</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span>
</pre></div>
</div>
<p>One must register the event by calling <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventRegister.html">PetscLogEventRegister</a>()</span></code>,
which assigns a unique integer to identify the event for profiling
purposes:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEventRegister.html">PetscLogEventRegister</a></span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">string</span><span class="p">[],</span><span class="n"><a href="../manualpages/Sys/PetscClassId.html">PetscClassId</a></span><span class="w"> </span><span class="n">classid</span><span class="p">,</span><span class="n"><a href="../manualpages/Log/PetscLogEvent.html">PetscLogEvent</a></span><span class="w"> </span><span class="o">*</span><span class="n">e</span><span class="p">);</span>
</pre></div>
</div>
<p>Here <code class="docutils notranslate"><span class="pre">string</span></code> is a user-defined event name, and <code class="docutils notranslate"><span class="pre">color</span></code> is an
optional user-defined event color (for use with <em>Jumpshot</em> logging; see
<a class="reference internal" href="#sec-mpelogs"><span class="std std-ref">Using -log_mpe with Jumpshot</span></a>); one should see the manual page for
details. The argument returned in <code class="docutils notranslate"><span class="pre">e</span></code> should then be passed to the
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventBegin.html">PetscLogEventBegin</a>()</span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventEnd.html">PetscLogEventEnd</a>()</span></code> routines.</p>
<p>Events are logged by using the pair</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEventBegin.html">PetscLogEventBegin</a></span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">event</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o1</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o2</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o3</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o4</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventEnd.html">PetscLogEventEnd</a></span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">event</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o1</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o2</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o3</span><span class="p">,</span><span class="n"><a href="../manualpages/Sys/PetscObject.html">PetscObject</a></span><span class="w"> </span><span class="n">o4</span><span class="p">);</span>
</pre></div>
</div>
<p>The four objects are the PETSc objects that are most closely associated
with the event. For instance, in a matrix-vector product they would be
the matrix and the two vectors. These objects can be omitted by
specifying 0 for <code class="docutils notranslate"><span class="pre">o1</span></code> - <code class="docutils notranslate"><span class="pre">o4</span></code>. The code between these two routine
calls will be automatically timed and logged as part of the specified
event.</p>
<p>Events are collective by default on the communicator of <code class="docutils notranslate"><span class="pre">o1</span></code> (if present).
They can be made not collective by using <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventSetCollective.html">PetscLogEventSetCollective</a>()</span></code>.
No synchronization is performed on collective events in optimized builds unless
the command line option <code class="docutils notranslate"><span class="pre">-log_sync</span></code> is used; however, we do check for collective
semantics in debug mode.</p>
<p>The user can log the number of floating-point operations for this
segment of code by calling</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogFlops.html">PetscLogFlops</a></span><span class="p">(</span><span class="n">number</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">flop</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">code</span><span class="w"> </span><span class="n">segment</span><span class="p">);</span>
</pre></div>
</div>
<p>between the calls to <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventBegin.html">PetscLogEventBegin</a>()</span></code> and
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventEnd.html">PetscLogEventEnd</a>()</span></code>. This value will automatically be added to the
global flop counter for the entire program.</p>
</section>
<section id="profiling-multiple-sections-of-code">
<span id="sec-profstages"></span><h2>Profiling Multiple Sections of Code<a class="headerlink" href="#profiling-multiple-sections-of-code" title="Link to this heading">#</a></h2>
<p>By default, the profiling produces a single set of statistics for all
code between the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Sys/PetscInitialize.html">PetscInitialize</a>()</span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Sys/PetscFinalize.html">PetscFinalize</a>()</span></code> calls
within a program. One can independently monitor several “stages” of code
by switching among the various stages with the commands</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogStagePush.html">PetscLogStagePush</a></span><span class="p">(</span><span class="n"><a href="../manualpages/Log/PetscLogStage.html">PetscLogStage</a></span><span class="w"> </span><span class="n">stage</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogStagePop.html">PetscLogStagePop</a></span><span class="p">();</span>
</pre></div>
</div>
<p>see the manual pages for details.
The command</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogStageRegister.html">PetscLogStageRegister</a></span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">name</span><span class="p">,</span><span class="n"><a href="../manualpages/Log/PetscLogStage.html">PetscLogStage</a></span><span class="w"> </span><span class="o">*</span><span class="n">stage</span><span class="p">)</span>
</pre></div>
</div>
<p>allows one to associate a name with a stage; these names are printed
whenever summaries are generated with <code class="docutils notranslate"><span class="pre">-log_view</span></code>. The following code fragment uses three profiling
stages within an program.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Sys/PetscInitialize.html">PetscInitialize</a></span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="o">*</span><span class="n">argc</span><span class="p">,</span><span class="kt">char</span><span class="w"> </span><span class="o">***</span><span class="n">args</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span>
<span class="cm">/* stage 0 of code here */</span>
<span class="n"><a href="../manualpages/Log/PetscLogStageRegister.html">PetscLogStageRegister</a></span><span class="p">(</span><span class="s">&quot;Stage 0 of Code&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">stagenum0</span><span class="p">);</span>
<span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="o">&lt;</span><span class="n">ntimes</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStageRegister.html">PetscLogStageRegister</a></span><span class="p">(</span><span class="s">&quot;Stage 1 of Code&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">stagenum1</span><span class="p">);</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStagePush.html">PetscLogStagePush</a></span><span class="p">(</span><span class="n">stagenum1</span><span class="p">);</span>
<span class="w">    </span><span class="cm">/* stage 1 of code here */</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStagePop.html">PetscLogStagePop</a></span><span class="p">();</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStageRegister.html">PetscLogStageRegister</a></span><span class="p">(</span><span class="s">&quot;Stage 2 of Code&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">stagenum2</span><span class="p">);</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStagePush.html">PetscLogStagePush</a></span><span class="p">(</span><span class="n">stagenum2</span><span class="p">);</span>
<span class="w">    </span><span class="cm">/* stage 2 of code here */</span>
<span class="w">    </span><span class="n"><a href="../manualpages/Log/PetscLogStagePop.html">PetscLogStagePop</a></span><span class="p">();</span>
<span class="p">}</span>
<span class="n"><a href="../manualpages/Sys/PetscFinalize.html">PetscFinalize</a></span><span class="p">();</span>
</pre></div>
</div>
<p>The listings above
show output generated by
<code class="docutils notranslate"><span class="pre">-log_view</span></code> for a program that employs several profiling stages. In
particular, this program is subdivided into six stages: loading a matrix and right-hand-side vector from a binary file,
setting up the preconditioner, and solving the linear system; this
sequence is then repeated for a second linear system. For simplicity,
the second listing contains output only for
stages 5 and 6 (linear solve of the second system), which comprise the
part of this computation of most interest to us in terms of performance
monitoring. This code organization (solving a small linear system
followed by a larger system) enables generation of more accurate
profiling statistics for the second system by overcoming the often
considerable overhead of paging, as discussed in
<a class="reference internal" href="#sec-profaccuracy"><span class="std std-ref">Accurate Profiling and Paging Overheads</span></a>.</p>
</section>
<section id="restricting-event-logging">
<span id="sec-deactivate"></span><h2>Restricting Event Logging<a class="headerlink" href="#restricting-event-logging" title="Link to this heading">#</a></h2>
<p>By default, all PETSc operations are logged. To enable or disable the
PETSc logging of individual events, one uses the commands</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEventActivate.html">PetscLogEventActivate</a></span><span class="p">(</span><span class="n"><a href="../manualpages/Log/PetscLogEvent.html">PetscLogEvent</a></span><span class="w"> </span><span class="n">event</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventDeactivate.html">PetscLogEventDeactivate</a></span><span class="p">(</span><span class="n"><a href="../manualpages/Log/PetscLogEvent.html">PetscLogEvent</a></span><span class="w"> </span><span class="n">event</span><span class="p">);</span>
</pre></div>
</div>
<p>The <code class="docutils notranslate"><span class="pre">event</span></code> may be either a predefined PETSc event (as listed in the
file <code class="docutils notranslate"><span class="pre">$PETSC_DIR/include/petsclog.h</span></code>) or one obtained with
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscLogEventRegister.html">PetscLogEventRegister</a>()</span></code> (as described in
<a class="reference internal" href="#sec-profileuser"><span class="std std-ref">Profiling Application Codes</span></a>).</p>
<p>PETSc also provides routines that deactivate (or activate) logging for
entire components of the library. Currently, the components that support
such logging (de)activation are <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/Mat.html">Mat</a></span></code> (matrices), <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Vec/Vec.html">Vec</a></span></code> (vectors),
<code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> (linear solvers, including <code class="docutils notranslate"><span class="pre"><a href="../manualpages/KSP/KSP.html">KSP</a></span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/PC/PC.html">PC</a></span></code>), and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/SNES/SNES.html">SNES</a></span></code>
(nonlinear solvers):</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEventDeactivateClass.html">PetscLogEventDeactivateClass</a></span><span class="p">(</span><span class="n">MAT_CLASSID</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventDeactivateClass.html">PetscLogEventDeactivateClass</a></span><span class="p">(</span><span class="n">KSP_CLASSID</span><span class="p">);</span><span class="w"> </span><span class="cm">/* includes <a href="../manualpages/PC/PC.html">PC</a> and <a href="../manualpages/KSP/KSP.html">KSP</a> */</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventDeactivateClass.html">PetscLogEventDeactivateClass</a></span><span class="p">(</span><span class="n">VEC_CLASSID</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventDeactivateClass.html">PetscLogEventDeactivateClass</a></span><span class="p">(</span><span class="n">SNES_CLASSID</span><span class="p">);</span>
</pre></div>
</div>
<p>and</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscLogEventActivateClass.html">PetscLogEventActivateClass</a></span><span class="p">(</span><span class="n">MAT_CLASSID</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventActivateClass.html">PetscLogEventActivateClass</a></span><span class="p">(</span><span class="n">KSP_CLASSID</span><span class="p">);</span><span class="w">   </span><span class="cm">/* includes <a href="../manualpages/PC/PC.html">PC</a> and <a href="../manualpages/KSP/KSP.html">KSP</a> */</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventActivateClass.html">PetscLogEventActivateClass</a></span><span class="p">(</span><span class="n">VEC_CLASSID</span><span class="p">);</span>
<span class="n"><a href="../manualpages/Log/PetscLogEventActivateClass.html">PetscLogEventActivateClass</a></span><span class="p">(</span><span class="n">SNES_CLASSID</span><span class="p">);</span>
</pre></div>
</div>
</section>
<section id="interpreting-info-output-informative-messages">
<span id="sec-petscinfo"></span><h2>Interpreting <code class="docutils notranslate"><span class="pre">-info</span></code> Output: Informative Messages<a class="headerlink" href="#interpreting-info-output-informative-messages" title="Link to this heading">#</a></h2>
<p>Users can activate the printing of verbose information about algorithms,
data structures, etc. to the screen by using the option <code class="docutils notranslate"><span class="pre">-info</span></code> or by
calling <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscInfoAllow.html">PetscInfoAllow</a>(<a href="../manualpages/Sys/PETSC_TRUE.html">PETSC_TRUE</a>)</span></code>. Such logging, which is used
throughout the PETSc libraries, can aid the user in understanding
algorithms and tuning program performance. For example, as discussed in
<a class="reference internal" href="mat.html#sec-matsparse"><span class="std std-ref">Sparse Matrices</span></a>, <code class="docutils notranslate"><span class="pre">-info</span></code> activates the printing of
information about memory allocation during matrix assembly.</p>
<p>One can selectively turn off informative messages about any of the basic
PETSc objects (e.g., <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/Mat.html">Mat</a></span></code>, <code class="docutils notranslate"><span class="pre"><a href="../manualpages/SNES/SNES.html">SNES</a></span></code>) with the command</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscInfoDeactivateClass.html">PetscInfoDeactivateClass</a></span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">object_classid</span><span class="p">)</span>
</pre></div>
</div>
<p>where <code class="docutils notranslate"><span class="pre">object_classid</span></code> is one of <code class="docutils notranslate"><span class="pre">MAT_CLASSID</span></code>, <code class="docutils notranslate"><span class="pre">SNES_CLASSID</span></code>,
etc. Messages can be reactivated with the command</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscInfoActivateClass.html">PetscInfoActivateClass</a></span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">object_classid</span><span class="p">)</span>
</pre></div>
</div>
<p>Such deactivation can be useful when one wishes to view information
about higher-level PETSc libraries (e.g., <code class="docutils notranslate"><span class="pre"><a href="../manualpages/TS/TS.html">TS</a></span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/SNES/SNES.html">SNES</a></span></code>) without
seeing all lower level data as well (e.g., <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Mat/Mat.html">Mat</a></span></code>).</p>
<p>One can turn on or off logging for particular classes at runtime</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">-info [filename][:[~]&lt;list,of,classnames&gt;[:[~]self]]</span>
</pre></div>
</div>
<p>The <code class="docutils notranslate"><span class="pre">list,of,classnames</span></code> is a list, separated by commas with no spaces, of classes one wishes to view the information on. For
example <code class="docutils notranslate"><span class="pre">vec,ksp</span></code>. Information on all other classes will not be displayed. The ~ indicates to not display the list of classes but rather to display all other classes.</p>
<p><code class="docutils notranslate"><span class="pre">self</span></code> indicates to display information on objects that are associated with <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Sys/PETSC_COMM_SELF.html">PETSC_COMM_SELF</a></span></code> while <code class="docutils notranslate"><span class="pre">~self</span></code> indicates to display information only for parallel objects.</p>
<p>See <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Log/PetscInfo.html">PetscInfo</a>()</span></code> for links to all the info operations that are available.</p>
<p>Application programmers can log their own messages, as well, by using the
routine</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscInfo.html">PetscInfo</a></span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="n">obj</span><span class="p">,</span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">message</span><span class="p">,...)</span>
</pre></div>
</div>
<p>where <code class="docutils notranslate"><span class="pre">obj</span></code> is the PETSc object associated most closely with the
logging statement, <code class="docutils notranslate"><span class="pre">message</span></code>. For example, in the line search Newton
methods, we use a statement such as</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscInfo.html">PetscInfo</a></span><span class="p">(</span><span class="n">snes</span><span class="p">,</span><span class="s">&quot;Cubic step, lambda %g</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="n">lambda</span><span class="p">);</span>
</pre></div>
</div>
</section>
<section id="time">
<h2>Time<a class="headerlink" href="#time" title="Link to this heading">#</a></h2>
<p>PETSc application programmers can access the wall clock time directly
with the command</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Sys/PetscLogDouble.html">PetscLogDouble</a></span><span class="w"> </span><span class="n">time</span><span class="p">;</span>
<span class="n"><a href="../manualpages/Sys/PetscCall.html">PetscCall</a></span><span class="p">(</span><span class="n"><a href="../manualpages/Sys/PetscTime.html">PetscTime</a></span><span class="p">(</span><span class="o">&amp;</span><span class="n">time</span><span class="p">));</span>
</pre></div>
</div>
<p>which returns the current time in seconds since the epoch, and is
commonly implemented with <code class="docutils notranslate"><span class="pre"><a href="http://www.mpich.org/static/docs/latest/www3/MPI_Wtime.html#MPI_Wtime">MPI_Wtime</a></span></code>. A floating point number is
returned in order to express fractions of a second. In addition, as
discussed in <a class="reference internal" href="#sec-profileuser"><span class="std std-ref">Profiling Application Codes</span></a>, PETSc can automatically
profile user-defined segments of code.</p>
</section>
<section id="saving-output-to-a-file">
<h2>Saving Output to a File<a class="headerlink" href="#saving-output-to-a-file" title="Link to this heading">#</a></h2>
<p>All output from PETSc programs (including informative messages,
profiling information, and convergence data) can be saved to a file by
using the command line option <code class="docutils notranslate"><span class="pre">-history</span> <span class="pre">[filename]</span></code>. If no file name
is specified, the output is stored in the file
<code class="docutils notranslate"><span class="pre">${HOME}/.petschistory</span></code>. Note that this option only saves output
printed with the <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Sys/PetscPrintf.html">PetscPrintf</a>()</span></code> and <code class="docutils notranslate"><span class="pre"><a href="../manualpages/Sys/PetscFPrintf.html">PetscFPrintf</a>()</span></code> commands, not
the standard <code class="docutils notranslate"><span class="pre">printf()</span></code> and <code class="docutils notranslate"><span class="pre">fprintf()</span></code> statements.</p>
</section>
<section id="accurate-profiling-and-paging-overheads">
<span id="sec-profaccuracy"></span><h2>Accurate Profiling and Paging Overheads<a class="headerlink" href="#accurate-profiling-and-paging-overheads" title="Link to this heading">#</a></h2>
<p>One factor that often plays a significant role in profiling a code is
paging by the operating system. Generally, when running a program, only
a few pages required to start it are loaded into memory rather than the
entire executable. When the execution proceeds to code segments that are
not in memory, a pagefault occurs, prompting the required pages to be
loaded from the disk (a very slow process). This activity distorts the
results significantly. (The paging effects are noticeable in the log
files generated by <code class="docutils notranslate"><span class="pre">-log_mpe</span></code>, which is described in
<a class="reference internal" href="#sec-mpelogs"><span class="std std-ref">Using -log_mpe with Jumpshot</span></a>.)</p>
<p>To eliminate the effects of paging when profiling the performance of a
program, we have found an effective procedure is to run the <em>exact same
code</em> on a small dummy problem before running it on the actual problem
of interest. We thus ensure that all code required by a solver is loaded
into memory during solution of the small problem. When the code proceeds
to the actual (larger) problem of interest, all required pages have
already been loaded into main memory, so that the performance numbers
are not distorted.</p>
<p>When this procedure is used in conjunction with the user-defined stages
of profiling described in <a class="reference internal" href="#sec-profstages"><span class="std std-ref">Profiling Multiple Sections of Code</span></a>, we can
focus easily on the problem of interest. For example, we used this
technique in the program
<a href="../src/ksp/ksp/tutorials/ex10.c.html">KSP Tutorial ex10</a>
to generate the timings within
<a class="reference internal" href="#listing-exparprof"><span class="std std-ref">listing</span></a> and <a class="reference internal" href="#listing-exparprof2"><span class="std std-ref">listing</span></a>.
In this case, the profiled code
of interest (solving the linear system for the larger problem) occurs
within event stages 5 and 6. <a class="reference internal" href="#sec-parperformance"><span class="std std-ref">Interpreting -log_view Output: Parallel Performance</span></a>
provides details about interpreting such profiling data.</p>
<p>In particular, the macros</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscPreLoadBegin.html">PetscPreLoadBegin</a></span><span class="p">(</span><span class="n"><a href="../manualpages/Sys/PetscBool.html">PetscBool</a></span><span class="w"> </span><span class="n">flag</span><span class="p">,</span><span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="n">stagename</span><span class="p">)</span>
<span class="n"><a href="../manualpages/Log/PetscPreLoadStage.html">PetscPreLoadStage</a></span><span class="p">(</span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">stagename</span><span class="p">)</span>
</pre></div>
</div>
<p>and</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n"><a href="../manualpages/Log/PetscPreLoadEnd.html">PetscPreLoadEnd</a></span><span class="p">()</span>
</pre></div>
</div>
<p>can be used to easily convert a regular PETSc program to one that uses
preloading. The command line options <code class="docutils notranslate"><span class="pre">-preload</span></code> <code class="docutils notranslate"><span class="pre">true</span></code> and
<code class="docutils notranslate"><span class="pre">-preload</span></code> <code class="docutils notranslate"><span class="pre">false</span></code> may be used to turn on and off preloading at run
time for PETSc programs that use these macros.</p>
</section>
<section id="nvidia-nsight-systems-profiling">
<h2>NVIDIA Nsight Systems profiling<a class="headerlink" href="#nvidia-nsight-systems-profiling" title="Link to this heading">#</a></h2>
<p>Nsight Systems will generate profiling data with a CUDA executable
with the command <code class="docutils notranslate"><span class="pre">nsys</span></code>.
For example, in serial</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>nsys<span class="w"> </span>profile<span class="w"> </span>-t<span class="w"> </span>nvtx,cuda<span class="w"> </span>-o<span class="w"> </span>file<span class="w"> </span>--stats<span class="o">=</span><span class="nb">true</span><span class="w"> </span>--force-overwrite<span class="w"> </span><span class="nb">true</span><span class="w"> </span>./a.out
</pre></div>
</div>
<p>will generate a file <code class="docutils notranslate"><span class="pre">file.qdstrm</span></code> with performance data that is
annotated with PETSc events (methods) and Kokkos device kernel names.
The Nsight Systems GUI, <code class="docutils notranslate"><span class="pre">nsys-ui</span></code>, can be used to navigate this file
(<a class="reference external" href="https://developer.nvidia.com/nsight-systems">https://developer.nvidia.com/nsight-systems</a>). The Nsight Systems GUI
lets you see a timeline of code performance information like kernels,
memory mallocs and frees, CPU-GPU communication, and high-level data like time, sizes
of memory copies, and more, in a popup window when the mouse
hovers over the section.
To view the data, start <code class="docutils notranslate"><span class="pre">nsys-ui</span></code> without any arguments and then <code class="docutils notranslate"><span class="pre">Import</span></code> the
<code class="docutils notranslate"><span class="pre">.qdstrm</span></code> file in the GUI.
A side effect of this viewing process is the generation of a file <code class="docutils notranslate"><span class="pre">file.nsys-rep</span></code>, which can be viewed directly
with <code class="docutils notranslate"><span class="pre">nsys-ui</span></code> in the future.</p>
<p>For an MPI parallel job, only one process can call <code class="docutils notranslate"><span class="pre">nsys</span></code>,
say have rank zero output <code class="docutils notranslate"><span class="pre">nsys</span></code> data and have all other
ranks call the executable directly. For example with MPICH
or Open MPI - we can run a parallel job on 4 MPI tasks as:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">mpiexec -n 1 nsys profile -t nvtx,cuda -o file_name --stats=true --force-overwrite true ./a.out : -n 3 ./a.out</span>
</pre></div>
</div>
<p id="sec-using-tau">Note: The Nsight GUI can open profiling reports from elsewhere. For
example, a report from a compute node can be analyzed on your local
machine, but care should be taken to use the exact same versions of
Nsight Systems that generated the report.
To check the version of Nsight on the compute node run <code class="docutils notranslate"><span class="pre">nsys-ui</span></code> and
note the version number at the top of the window.</p>
</section>
<section id="using-tau">
<h2>Using TAU<a class="headerlink" href="#using-tau" title="Link to this heading">#</a></h2>
<p>TAU profiles can be generated without the need for instrumentation through the
use of the perfstubs package. PETSc by default is configured with <code class="docutils notranslate"><span class="pre">--with-tau-perfstubs</span></code>.
To generate profiles with TAU, first setup TAU:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>wget<span class="w"> </span>http://tau.uoregon.edu/tau.tgz
./configure<span class="w"> </span>-cc<span class="o">=</span>mpicc<span class="w"> </span>-c++<span class="o">=</span>mpicxx<span class="w"> </span>-mpi<span class="w"> </span>-bfd<span class="o">=</span>download<span class="w"> </span>-unwind<span class="o">=</span>download<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>make<span class="w"> </span>install
<span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span>&lt;tau<span class="w"> </span>dir&gt;/x86_64/bin:<span class="nv">$PATH</span>
</pre></div>
</div>
<p>For more information on configuring TAU, see <a class="reference external" href="http://tau.uoregon.edu">http://tau.uoregon.edu</a>.
Next, run your program with TAU. For instance, to profile <code class="docutils notranslate"><span class="pre">ex56</span></code>,</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span><span class="nv">$PETSC_DIR</span>/src/snes/tutorials
make<span class="w"> </span>ex56
mpirun<span class="w"> </span>-n<span class="w"> </span><span class="m">4</span><span class="w"> </span>tau_exec<span class="w"> </span>-T<span class="w"> </span>mpi<span class="w"> </span>./ex56<span class="w"> </span>-log_perfstubs<span class="w"> </span>&lt;args&gt;
</pre></div>
</div>
<p>This should produce four <code class="docutils notranslate"><span class="pre">profile.*</span></code> files with profile data that can be
viewed with <code class="docutils notranslate"><span class="pre">paraprof/pprof</span></code>:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>Reading<span class="w"> </span>Profile<span class="w"> </span>files<span class="w"> </span><span class="k">in</span><span class="w"> </span>profile.*

NODE<span class="w"> </span><span class="m">0</span><span class="p">;</span>CONTEXT<span class="w"> </span><span class="m">0</span><span class="p">;</span>THREAD<span class="w"> </span><span class="m">0</span>:
---------------------------------------------------------------------------------------
%Time<span class="w">    </span>Exclusive<span class="w">    </span>Inclusive<span class="w">       </span><span class="c1">#Call      #Subrs  Inclusive Name</span>
<span class="w">              </span>msec<span class="w">   </span>total<span class="w"> </span>msec<span class="w">                          </span>usec/call
---------------------------------------------------------------------------------------
<span class="m">100</span>.0<span class="w">           </span><span class="m">26</span><span class="w">        </span><span class="m">1</span>,838<span class="w">           </span><span class="m">1</span><span class="w">       </span><span class="m">41322</span><span class="w">    </span><span class="m">1838424</span><span class="w"> </span>.TAU<span class="w"> </span>application
<span class="w"> </span><span class="m">73</span>.2<span class="w">            </span><span class="m">1</span><span class="w">        </span><span class="m">1</span>,345<span class="w">           </span><span class="m">2</span><span class="w">         </span><span class="m">168</span><span class="w">     </span><span class="m">672950</span><span class="w"> </span><a href="../manualpages/SNES/SNESSolve.html">SNESSolve</a>
<span class="w"> </span><span class="m">62</span>.2<span class="w">            </span><span class="m">3</span><span class="w">        </span><span class="m">1</span>,142<span class="w">           </span><span class="m">2</span><span class="w">        </span><span class="m">1282</span><span class="w">     </span><span class="m">571442</span><span class="w"> </span>SNESJacobianEval
<span class="w"> </span><span class="m">62</span>.0<span class="w">        </span><span class="m">1</span>,136<span class="w">        </span><span class="m">1</span>,138<span class="w">           </span><span class="m">2</span><span class="w">          </span><span class="m">76</span><span class="w">     </span><span class="m">569494</span><span class="w"> </span>DMPlexJacobianFE
<span class="w"> </span><span class="m">60</span>.1<span class="w">        </span><span class="m">0</span>.046<span class="w">        </span><span class="m">1</span>,105<span class="w">           </span><span class="m">1</span><span class="w">          </span><span class="m">32</span><span class="w">    </span><span class="m">1105001</span><span class="w"> </span>Solve<span class="w"> </span><span class="m">1</span>
<span class="w"> </span><span class="m">15</span>.2<span class="w">           </span><span class="m">87</span><span class="w">          </span><span class="m">279</span><span class="w">           </span><span class="m">5</span><span class="w">       </span><span class="m">11102</span><span class="w">      </span><span class="m">55943</span><span class="w"> </span>Mesh<span class="w"> </span>Setup
<span class="w"> </span><span class="m">13</span>.2<span class="w">        </span><span class="m">0</span>.315<span class="w">          </span><span class="m">241</span><span class="w">           </span><span class="m">1</span><span class="w">          </span><span class="m">32</span><span class="w">     </span><span class="m">241765</span><span class="w"> </span>Solve<span class="w"> </span><span class="m">0</span>
<span class="w">  </span><span class="m">7</span>.8<span class="w">           </span><span class="m">80</span><span class="w">          </span><span class="m">144</span><span class="w">       </span><span class="m">38785</span><span class="w">       </span><span class="m">38785</span><span class="w">          </span><span class="m">4</span><span class="w"> </span><a href="http://www.mpich.org/static/docs/latest/www3/MPI_Allreduce.html#MPI_Allreduce">MPI_Allreduce</a><span class="o">()</span>
<span class="w">  </span><span class="m">7</span>.0<span class="w">           </span><span class="m">69</span><span class="w">          </span><span class="m">128</span><span class="w">           </span><span class="m">6</span><span class="w">       </span><span class="m">43386</span><span class="w">      </span><span class="m">21491</span><span class="w"> </span>DualSpaceSetUp
<span class="w">  </span><span class="m">6</span>.2<span class="w">            </span><span class="m">1</span><span class="w">          </span><span class="m">114</span><span class="w">           </span><span class="m">4</span><span class="w">          </span><span class="m">54</span><span class="w">      </span><span class="m">28536</span><span class="w"> </span><a href="../manualpages/PC/PCSetUp.html">PCSetUp</a>
<span class="w">  </span><span class="m">6</span>.0<span class="w">           </span><span class="m">12</span><span class="w">          </span><span class="m">110</span><span class="w">           </span><span class="m">2</span><span class="w">         </span><span class="m">892</span><span class="w">      </span><span class="m">55407</span><span class="w"> </span>PCSetUp_GAMG+
<span class="w">  </span><span class="m">3</span>.9<span class="w">           </span><span class="m">70</span><span class="w">           </span><span class="m">70</span><span class="w">           </span><span class="m">1</span><span class="w">           </span><span class="m">0</span><span class="w">      </span><span class="m">70888</span><span class="w"> </span><a href="http://www.mpich.org/static/docs/latest/www3/MPI_Init_thread.html#MPI_Init_thread">MPI_Init_thread</a><span class="o">()</span>
<span class="w">  </span><span class="m">3</span>.7<span class="w">           </span><span class="m">68</span><span class="w">           </span><span class="m">68</span><span class="w">       </span><span class="m">41747</span><span class="w">           </span><span class="m">0</span><span class="w">          </span><span class="m">2</span><span class="w"> </span>MPI<span class="w"> </span>Collective<span class="w"> </span>Sync
<span class="w">  </span><span class="m">3</span>.6<span class="w">            </span><span class="m">8</span><span class="w">           </span><span class="m">66</span><span class="w">           </span><span class="m">4</span><span class="w">        </span><span class="m">3536</span><span class="w">      </span><span class="m">16548</span><span class="w"> </span>SNESFunctionEval
<span class="w">  </span><span class="m">2</span>.6<span class="w">           </span><span class="m">45</span><span class="w">           </span><span class="m">48</span><span class="w">         </span><span class="m">171</span><span class="w">         </span><span class="m">171</span><span class="w">        </span><span class="m">281</span><span class="w"> </span><a href="http://www.mpich.org/static/docs/latest/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</a><span class="o">()</span>
<span class="w">  </span><span class="m">1</span>.9<span class="w">           </span><span class="m">34</span><span class="w">           </span><span class="m">34</span><span class="w">        </span><span class="m">7836</span><span class="w">           </span><span class="m">0</span><span class="w">          </span><span class="m">4</span><span class="w"> </span><a href="http://www.mpich.org/static/docs/latest/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</a><span class="o">()</span>
<span class="w">  </span><span class="m">1</span>.8<span class="w">        </span><span class="m">0</span>.567<span class="w">           </span><span class="m">33</span><span class="w">           </span><span class="m">2</span><span class="w">          </span><span class="m">68</span><span class="w">      </span><span class="m">16912</span><span class="w">  </span>GAMG<span class="w"> </span>Coarsen
</pre></div>
</div>
<hr><div class="docutils container" id="id1">
<div role="list" class="citation-list">
<div class="citation" id="id1189" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id2">Getal</a><span class="fn-bracket">]</span></span>
<p>William Gropp and et. al. MPICH Web page. <a class="reference external" href="http://www.mpich.org">http://www.mpich.org</a>. URL: <a class="reference external" href="http://www.mpich.org">http://www.mpich.org</a>.</p>
</div>
<div class="citation" id="id1198" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">HL91</a><span class="fn-bracket">]</span></span>
<p>Virginia Herrarte and Ewing Lusk. Studying parallel program behavior with Upshot. Technical Report ANL-91/15, Argonne National Laboratory, August 1991.</p>
</div>
</div>
</div>
</section>
</section>


                </article>
              
              
              
              
              
                <footer class="prev-next-footer">
                  
<div class="prev-next-area">
    <a class="left-prev"
       href="matlab.html"
       title="previous page">
      <i class="fa-solid fa-angle-left"></i>
      <div class="prev-next-info">
        <p class="prev-next-subtitle">previous</p>
        <p class="prev-next-title">Using MATLAB with PETSc</p>
      </div>
    </a>
    <a class="right-next"
       href="performance.html"
       title="next page">
      <div class="prev-next-info">
        <p class="prev-next-subtitle">next</p>
        <p class="prev-next-title">Hints for Performance Tuning</p>
      </div>
      <i class="fa-solid fa-angle-right"></i>
    </a>
</div>
                </footer>
              
            </div>
            
            
              
                <div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">


  <div class="sidebar-secondary-item">
<div
    id="pst-page-navigation-heading-2"
    class="page-toc tocsection onthispage">
    <i class="fa-solid fa-list"></i> On this page
  </div>
  <nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
    <ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#basic-profiling-information">Basic Profiling Information</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#interpreting-log-view-output-the-basics">Interpreting <code class="docutils notranslate"><span class="pre">-log_view</span></code> Output: The Basics</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#interpreting-log-view-output-parallel-performance">Interpreting <code class="docutils notranslate"><span class="pre">-log_view</span></code> Output: Parallel Performance</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#using-log-mpe-with-jumpshot">Using <code class="docutils notranslate"><span class="pre">-log_mpe</span></code> with Jumpshot</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#profiling-nested-events">Profiling Nested Events</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#profiling-application-codes">Profiling Application Codes</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#profiling-multiple-sections-of-code">Profiling Multiple Sections of Code</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#restricting-event-logging">Restricting Event Logging</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#interpreting-info-output-informative-messages">Interpreting <code class="docutils notranslate"><span class="pre">-info</span></code> Output: Informative Messages</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#time">Time</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#saving-output-to-a-file">Saving Output to a File</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#accurate-profiling-and-paging-overheads">Accurate Profiling and Paging Overheads</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#nvidia-nsight-systems-profiling">NVIDIA Nsight Systems profiling</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#using-tau">Using TAU</a></li>
</ul>
  </nav></div>

  <div class="sidebar-secondary-item">

  
  <div class="tocsection editthispage">
    <a href="https://gitlab.com/petsc/petsc/-/edit/release/doc/manual/profiling.md">
      <i class="fa-solid fa-pencil"></i>
      
      
        
          Edit on GitLab
        
      
    </a>
  </div>
</div>

  <div class="sidebar-secondary-item">

  <div class="tocsection sourcelink">
    <a href="../_sources/manual/profiling.md.txt">
      <i class="fa-solid fa-file-lines"></i> Show Source
    </a>
  </div>
</div>

</div></div>
              
            
          </div>
          <footer class="bd-footer-content">
            
          </footer>
        
      </main>
    </div>
  </div>
  
  <!-- Scripts loaded after <body> so the DOM is not blocked -->
  <script src="../_static/scripts/bootstrap.js?digest=bd9e20870c6007c4c509"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=bd9e20870c6007c4c509"></script>

  <footer class="bd-footer">
<div class="bd-footer__inner bd-page-width">
  
    <div class="footer-items__start">
      
        <div class="footer-item">

  <p class="copyright">
    
      © Copyright 1991-2025, UChicago Argonne, LLC and the PETSc Development Team.
      <br/>
    
  </p>
</div>
      
        <div class="footer-item">

  <p class="sphinx-version">
    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
    <br/>
  </p>
</div>
      
    </div>
  
  
  
    <div class="footer-items__end">
      
        <div class="footer-item">
<p class="theme-version">
  Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.15.1.
</p></div>
      
        <div class="footer-item"><p class="last-updated">
  Last updated on 2025-04-30T13:10:40-0500 (v3.23.1).
  <br/>
</p></div>
      
    </div>
  
</div>

  </footer>
  </body>
</html>