-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathcontrollers.cpp
1431 lines (1404 loc) · 46.6 KB
/
controllers.cpp
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
// Copyright (c) 2015-2022, Lawrence Livermore National Security, LLC.
// See top-level LICENSE file for details.
#include "caliper/caliper-config.h"
#include "caliper/ConfigManager.h"
#include <cstring>
namespace
{
const char* event_trace_spec = R"json(
{
"name" : "event-trace",
"description" : "Record a trace of region enter/exit events in .cali format",
"services" : [ "async_event", "event", "recorder", "timer", "trace" ],
"categories" : [ "output", "metadata", "event" ],
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT" : "false" },
"options":
[
{
"name" : "outdir",
"description" : "Output directory",
"type" : "string",
"config" : { "CALI_RECORDER_DIRECTORY": "{}" }
},{
"name" : "trace.io",
"description" : "Trace I/O events",
"type" : "bool",
"services" : [ "io" ]
},{
"name" : "trace.mpi",
"description" : "Trace MPI events",
"type" : "bool",
"services" : [ "mpi" ],
"config" : { "CALI_MPI_BLACKLIST": "MPI_Wtime,MPI_Wtick,MPI_Comm_size,MPI_Comm_rank" }
},{
"name" : "trace.cuda",
"description" : "Trace CUDA API events",
"type" : "bool",
"services" : [ "cupti" ]
},{
"name" : "trace.io",
"description" : "Trace I/O events",
"type" : "bool",
"services" : [ "io" ]
},{
"name" : "trace.openmp",
"description" : "Trace OpenMP events",
"type" : "bool",
"services" : [ "ompt" ]
},{
"name" : "trace.kokkos",
"description" : "Trace Kokkos kernels",
"type" : "bool",
"services" : [ "kokkostime" ]
},{
"name" : "time.inclusive",
"description" : "Record inclusive region times",
"type" : "bool",
"config" : { "CALI_TIMER_INCLUSIVE_DURATION": "true" }
},{
"name" : "sampling",
"description" : "Enable call-path sampling",
"type" : "bool",
"services" : [ "callpath", "pthread", "sampler", "symbollookup" ],
"config" : { "CALI_SAMPLER_FREQUENCY": "200" }
},{
"name" : "sample.frequency",
"description" : "Sampling frequency when sampling",
"type" : "int",
"inherit" : "sampling",
"config" : { "CALI_SAMPLER_FREQUENCY": "{}" }
},{
"name" : "papi.counters",
"description" : "List of PAPI counters to read",
"type" : "string",
"services" : [ "papi" ],
"config" : { "CALI_PAPI_COUNTERS": "{}" }
},{
"name" : "cuda.activities",
"description" : "Trace CUDA activities",
"type" : "bool",
"services" : [ "cuptitrace" ],
"config" : { "CALI_CUPTITRACE_SNAPSHOT_TIMESTAMPS": "true" }
},{
"name" : "rocm.activities",
"description" : "Trace ROCm activities",
"type" : "bool",
"services" : [ "roctracer" ],
"config" : { "CALI_ROCTRACER_SNAPSHOT_TIMESTAMPS": "true" }
},{
"name" : "umpire.allocators",
"description" : "Umpire per-allocator allocation statistics",
"type" : "bool",
"services" : [ "umpire" ],
"config" : { "CALI_UMPIRE_PER_ALLOCATOR_STATISTICS": "true" }
}
]
}
)json";
const char* nvprof_spec = R"json(
{
"name" : "nvprof",
"services" : [ "nvtx" ],
"description" : "Forward Caliper regions to NVidia nvprof (deprecated; use nvtx)",
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" }
}
)json";
const char* nvtx_spec = R"json(
{
"name" : "nvtx",
"services" : [ "nvtx" ],
"description" : "Forward Caliper regions to NVidia NSight/NVprof",
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" }
}
)json";
const char* roctx_spec = R"json(
{
"name" : "roctx",
"services" : [ "roctx" ],
"description" : "Forward Caliper regions to ROCm rocprofiler",
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" }
}
)json";
const char* mpireport_spec = R"json(
{
"name" : "mpi-report",
"services" : [ "aggregate", "event", "mpi", "mpireport", "timer" ],
"description" : "Print time spent in MPI functions",
"categories" : [ "event" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_AGGREGATE_KEY" : "mpi.function",
"CALI_EVENT_TRIGGER" : "mpi.function",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_TIMER_SNAPSHOT_DURATION" : "true",
"CALI_TIMER_INCLUSIVE_DURATION" : "false",
"CALI_TIMER_UNIT" : "sec",
"CALI_MPI_BLACKLIST" :
"MPI_Comm_size,MPI_Comm_rank,MPI_Wtime",
"CALI_MPIREPORT_WRITE_ON_FINALIZE" : "false",
"CALI_MPIREPORT_CONFIG" :
"let
sum#time.duration=scale(sum#time.duration.ns,1e-9)
select
mpi.function as Function,
min(count) as \"Count (min)\",
max(count) as \"Count (max)\",
min(sum#time.duration) as \"Time (min)\",
max(sum#time.duration) as \"Time (max)\",
avg(sum#time.duration) as \"Time (avg)\",
percent_total(sum#time.duration) as \"Time %\"
group by
mpi.function
format
table
order by
percent_total#sum#time.duration desc
"
}
}
)json";
cali::ConfigManager::ConfigInfo event_trace_controller_info { event_trace_spec, nullptr, nullptr };
cali::ConfigManager::ConfigInfo nvprof_controller_info { nvprof_spec, nullptr, nullptr };
cali::ConfigManager::ConfigInfo nvtx_controller_info { nvtx_spec, nullptr, nullptr };
cali::ConfigManager::ConfigInfo roctx_controller_info { roctx_spec, nullptr, nullptr };
cali::ConfigManager::ConfigInfo mpireport_controller_info { mpireport_spec, nullptr, nullptr };
} // namespace
namespace cali
{
extern ConfigManager::ConfigInfo cuda_activity_profile_controller_info;
extern ConfigManager::ConfigInfo cuda_activity_report_controller_info;
extern ConfigManager::ConfigInfo hatchet_region_profile_controller_info;
extern ConfigManager::ConfigInfo hatchet_sample_profile_controller_info;
extern ConfigManager::ConfigInfo loop_report_controller_info;
extern ConfigManager::ConfigInfo openmp_report_controller_info;
extern ConfigManager::ConfigInfo rocm_activity_report_controller_info;
extern ConfigManager::ConfigInfo rocm_activity_profile_controller_info;
extern ConfigManager::ConfigInfo runtime_report_controller_info;
extern ConfigManager::ConfigInfo sample_report_controller_info;
extern ConfigManager::ConfigInfo spot_controller_info;
const ConfigManager::ConfigInfo* builtin_controllers_table[] = { &cuda_activity_profile_controller_info,
&cuda_activity_report_controller_info,
&::event_trace_controller_info,
&::nvprof_controller_info,
&::nvtx_controller_info,
&::roctx_controller_info,
&::mpireport_controller_info,
&hatchet_region_profile_controller_info,
&hatchet_sample_profile_controller_info,
&loop_report_controller_info,
&openmp_report_controller_info,
&rocm_activity_report_controller_info,
&rocm_activity_profile_controller_info,
&runtime_report_controller_info,
&sample_report_controller_info,
&spot_controller_info,
nullptr };
const char* builtin_base_option_specs = R"json(
[
{
"name" : "level",
"type" : "string",
"description" : "Minimum region level that triggers snapshots",
"category" : "event",
"config" : { "CALI_EVENT_REGION_LEVEL": "{}" }
},{
"name" : "include_branches",
"type" : "string",
"description" : "Only take snapshots for branches with the given region names.",
"category" : "event",
"config" : { "CALI_EVENT_INCLUDE_BRANCHES": "{}" }
},{
"name" : "include_regions",
"type" : "string",
"description" : "Only take snapshots for the given region names/patterns.",
"category" : "event",
"config" : { "CALI_EVENT_INCLUDE_REGIONS": "{}" }
},{
"name" : "exclude_regions",
"type" : "string",
"description" : "Do not take snapshots for the given region names/patterns.",
"category" : "event",
"config" : { "CALI_EVENT_EXCLUDE_REGIONS": "{}" }
},{
"name" : "region.count",
"description" : "Report number of begin/end region instances",
"type" : "bool",
"category" : "metric",
"query" :
[
{ "level" : "local",
"let" : [ "rc.count=first(sum#region.count,region.count)" ],
"select" : [ "sum(rc.count) as Calls unit count" ]
},
{ "level" : "cross", "select":
[
"min(sum#rc.count) as \"Calls/rank (min)\" unit count",
"avg(sum#rc.count) as \"Calls/rank (avg)\" unit count",
"max(sum#rc.count) as \"Calls/rank (max)\" unit count",
"sum(sum#rc.count) as \"Calls (total)\" unit count"
]
}
]
},{
"name" : "region.stats",
"description" : "Detailed region timing statistics (min/max/avg time per visit)",
"type" : "bool",
"category" : "metric",
"services" : [ "timer", "event" ],
"config" :
{
"CALI_TIMER_INCLUSIVE_DURATION" : "true",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "true"
},
"query" :
[
{ "level": "local",
"let":
[
"rs.count=first(sum#region.count,region.count)",
"rs.min=scale(min#time.inclusive.duration.ns,1e-9)",
"rs.max=scale(max#time.inclusive.duration.ns,1e-9)",
"rs.sum=scale(sum#time.inclusive.duration.ns,1e-9)"
],
"aggregate": [ "sum(rs.sum)" ],
"select":
[
"sum(rs.count) as Visits unit count",
"min(rs.min) as \"Min time/visit\" unit sec",
"ratio(rs.sum,rs.count) as \"Avg time/visit\" unit sec",
"max(rs.max) as \"Max time/visit\" unit sec"
]
},
{ "level": "cross", "select":
[
"sum(sum#rs.count) as Visits unit count",
"min(min#rs.min) as \"Min time/visit\" unit sec",
"ratio(sum#rs.sum,sum#rs.count) as \"Avg time/visit\" unit sec",
"max(max#rs.max) as \"Max time/visit\" unit sec"
]
}
]
},{
"name" : "loop.stats",
"description" : "Loop iteration count and time statistics",
"type" : "bool",
"category" : "metric",
"services" : [ "loop_statistics" ],
"query" :
[
{ "level" : "local",
"let" :
[
"ls.min=scale(min#iter.duration.ns,1e-9)",
"ls.avg=scale(avg#iter.duration.ns,1e-9)",
"ls.max=scale(max#iter.duration.ns,1e-9)"
],
"select" :
[
"max(max#iter.count) as \"Iterations\" unit count",
"min(ls.min) as \"Time/iter (min)\" unit sec",
"avg(ls.avg) as \"Time/iter (avg)\" unit sec",
"max(ls.max) as \"Time/iter (max)\" unit sec"
]
},
{ "level" : "cross", "select":
[
"max(max#max#iter.count) as \"Iterations\" unit count",
"min(min#ls.min) as \"Time/iter (min)\" unit sec",
"avg(avg#ls.avg) as \"Time/iter (avg)\" unit sec",
"max(max#ls.max) as \"Time/iter (max)\" unit sec"
]
}
]
},{
"name" : "async_events",
"description" : "Report timed asynchronous events",
"type" : "bool",
"category" : "metric",
"services" : [ "async_event" ],
"query":
[
{
"level" : "local",
"group by" : "async.end",
"let" :
[
"as.min=scale(min#event.duration.ns,1e-9)",
"as.avg=scale(avg#event.duration.ns,1e-9)",
"as.max=scale(max#event.duration.ns,1e-9)"
],
"select":
[
"async.end as \"Event\"",
"min(as.min) as \"Event time (min)\"",
"avg(as.avg) as \"Event time (avg)\"",
"max(as.max) as \"Event time (max)\""
]
},{
"level" : "cross",
"group by" : "async.end",
"select":
[
"async.end as \"Event\"",
"min(min#as.min) as \"Event time (min)\"",
"avg(avg#as.avg) as \"Event time (avg)\"",
"max(max#as.max) as \"Event time (max)\""
]
}
]
},{
"name" : "node.order",
"description" : "Report order in which regions first appeared",
"type" : "bool",
"category" : "metric",
"query" :
[
{ "level": "local", "select": [ "min(aggregate.slot) as \"Node order\"" ] },
{ "level": "cross", "select": [ "min(min#aggregate.slot) as \"Node order\"" ] }
]
},{
"name" : "output",
"description" : "Output location ('stdout', 'stderr', or filename)",
"type" : "string",
"category" : "output"
},{
"name" : "adiak.import_categories",
"services" : [ "adiak_import" ],
"description" : "Adiak import categories. Comma-separated list of integers.",
"type" : "string",
"category" : "adiak"
},{
"name" : "max_column_width",
"type" : "int",
"description" : "Maximum column width in the tree display",
"category" : "treeformatter"
},{
"name" : "print.metadata",
"type" : "bool",
"description" : "Print program metadata (Caliper globals and Adiak data)",
"category" : "treeformatter"
},{
"name" : "order_as_visited",
"type" : "bool",
"description" : "Print tree nodes in the original visit order",
"category" : "treeformatter",
"query" :
[
{ "level": "local",
"let": [ "o_a_v.slot=first(aggregate.slot)" ],
"aggregate": [ "min(o_a_v.slot)" ],
"order by": [ "min#o_a_v.slot" ]
},
{ "level": "cross",
"aggregate": [ "min(min#o_a_v.slot)" ],
"order by": [ "min#min#o_a_v.slot" ]
}
]
}
]
)json";
const char* builtin_mpi_option_specs = R"json(
[
{
"name" : "profile.mpi",
"type" : "bool",
"description" : "Profile MPI functions",
"category" : "region",
"services" : [ "mpi" ],
"config": { "CALI_MPI_BLACKLIST": "MPI_Comm_rank,MPI_Comm_size,MPI_Wtick,MPI_Wtime" }
},
{
"name" : "mpi.include",
"type" : "string",
"description" : "Only instrument these MPI functions.",
"category" : "region",
"config" : { "CALI_MPI_WHITELIST": "{}" }
},
{
"name" : "mpi.exclude",
"type" : "string",
"description" : "Do not instrument these MPI functions.",
"category" : "region",
"config" : { "CALI_MPI_BLACKLIST": "{}" }
},
{
"name" : "mpi.message.size",
"description": "MPI message size",
"type" : "bool",
"category" : "metric",
"services" : [ "mpi" ],
"config" : { "CALI_MPI_MSG_TRACING": "true", "CALI_MPI_BLACKLIST": "MPI_Wtime,MPI_Comm_rank,MPI_Comm_size" },
"query" :
[
{ "level" : "local",
"let" : [
"mpimsg.min=first(min#mpi.msg.size,mpi.msg.size)",
"mpimsg.avg=first(avg#mpi.msg.size,mpi.msg.size)",
"mpimsg.max=first(max#mpi.msg.size,mpi.msg.size)"
],
"select" : [
"min(mpimsg.min) as \"Msg size (min)\" unit Byte",
"avg(mpimsg.avg) as \"Msg size (avg)\" unit Byte",
"max(mpimsg.max) as \"Msg size (max)\" unit Byte"
]
},
{ "level" : "cross",
"select" : [
"min(min#mpimsg.min) as \"Msg size (min)\" unit Byte",
"avg(avg#mpimsg.avg) as \"Msg size (avg)\" unit Byte",
"max(max#mpimsg.max) as \"Msg size (max)\" unit Byte"
]
}
]
},
{
"name" : "mpi.message.count",
"description": "Number of MPI send/recv/collective operations",
"type" : "bool",
"category" : "metric",
"services" : [ "mpi" ],
"config" : { "CALI_MPI_MSG_TRACING": "true", "CALI_MPI_BLACKLIST": "MPI_Wtime,MPI_Comm_rank,MPI_Comm_size" },
"query" :
[
{ "level" : "local",
"let" : [
"mpicount.recv=first(sum#mpi.recv.count,mpi.recv.count)",
"mpicount.send=first(sum#mpi.send.count,mpi.send.count)",
"mpicount.coll=first(sum#mpi.coll.count,mpi.coll.count)"
],
"select" : [
"sum(mpicount.send) as \"Msgs sent\" unit count",
"sum(mpicount.recv) as \"Msgs recvd\" unit count",
"sum(mpicount.coll) as \"Collectives\" unit count"
]
},
{ "level" : "cross",
"select" : [
"avg(sum#mpicount.send) as \"Msgs sent (avg)\" unit count",
"max(sum#mpicount.send) as \"Msgs sent (max)\" unit count",
"avg(sum#mpicount.recv) as \"Msgs recvd (avg)\" unit count",
"max(sum#mpicount.recv) as \"Msgs recvd (max)\" unit count",
"max(sum#mpicount.coll) as \"Collectives (max)\" unit count"
]
}
]
},
{
"name" : "comm.stats",
"description" : "MPI message statistics in marked communication regions",
"type" : "bool",
"category" : "metric",
"services" : [ "async_event", "mpi" ],
"config" : { "CALI_MPI_MSG_PATTERN": "true", "CALI_MPI_BLACKLIST": "MPI_Wtime,MPI_Comm_rank,MPI_Comm_size" },
"query" :
[
{ "level" : "local",
"let" :
[
"cs.irecv_gap.min=scale(min#event.duration.ns,1e-9) if async.end=irecv.req_wait_gap",
"cs.irecv_gap.max=scale(max#event.duration.ns,1e-9) if async.end=irecv.req_wait_gap",
"cs.irecv_gap.avg=scale(avg#event.duration.ns,1e-9) if async.end=irecv.req_wait_gap"
],
"select" :
[
"min(min#total.send.count) as \"Sends (min)\"",
"max(max#total.send.count) as \"Sends (max)\"",
"sum(sum#total.send.count) as \"Sends (total)\"",
"min(min#total.recv.count) as \"Recvs (min)\"",
"max(max#total.recv.count) as \"Recvs (max)\"",
"sum(sum#total.recv.count) as \"Recvs (total)\"",
"min(min#total.dest.ranks) as \"Dst ranks (min)\"",
"max(max#total.dest.ranks) as \"Dst ranks (max)\"",
"avg(avg#total.dest.ranks) as \"Dst ranks (avg)\"",
"min(min#total.src.ranks) as \"Src ranks (min)\"",
"max(max#total.src.ranks) as \"Src ranks (max)\"",
"avg(avg#total.src.ranks) as \"Src ranks (avg)\"",
"max(max#total.coll.count) as \"Collectives (max)\"",
"min(min#mpi.send.size) as \"Bytes sent (min)\"",
"max(max#mpi.send.size) as \"Bytes sent (max)\"",
"sum(sum#mpi.send.size) as \"Bytes sent (total)\"",
"min(min#mpi.recv.size) as \"Bytes recv (min)\"",
"max(max#mpi.recv.size) as \"Bytes recv (max)\"",
"sum(sum#mpi.recv.size) as \"Bytes recv (total)\"",
"min(cs.irecv_gap.min) as \"Irecv gap (min)\"",
"avg(cs.irecv_gap.avg) as \"Irecv gap (avg)\"",
"max(cs.irecv_gap.max) as \"Irecv gap (max)\""
]
},
{ "level" : "cross",
"select" :
[
"min(min#min#total.send.count) as \"Sends (min)\"",
"max(max#max#total.send.count) as \"Sends (max)\"",
"sum(sum#sum#total.send.count) as \"Sends (total)\"",
"min(min#min#total.recv.count) as \"Recvs (min)\"",
"max(max#max#total.recv.count) as \"Recvs (max)\"",
"sum(sum#sum#total.recv.count) as \"Recvs (total)\"",
"min(min#min#total.dest.ranks) as \"Dst ranks (min)\"",
"max(max#max#total.dest.ranks) as \"Dst ranks (max)\"",
"avg(avg#avg#total.dest.ranks) as \"Dst ranks (avg)\"",
"min(min#min#total.src.ranks) as \"Src ranks (min)\"",
"max(max#max#total.src.ranks) as \"Src ranks (max)\"",
"avg(avg#avg#total.src.ranks) as \"Src ranks (avg)\"",
"max(max#max#total.coll.count) as \"Coll (max)\"",
"min(min#min#mpi.send.size) as \"Bytes sent (min)\"",
"max(max#max#mpi.send.size) as \"Bytes sent (max)\"",
"sum(sum#sum#mpi.send.size) as \"Bytes sent (total)\"",
"min(min#min#mpi.recv.size) as \"Bytes recv (min)\"",
"max(max#max#mpi.recv.size) as \"Bytes recv (max)\"",
"sum(sum#sum#mpi.recv.size) as \"Bytes recv (total)\"",
"min(min#cs.irecv_gap.min) as \"Irecv gap (min)\"",
"avg(avg#cs.irecv_gap.avg) as \"Irecv gap (avg)\"",
"max(max#cs.irecv_gap.max) as \"Irecv gap (max)\""
]
}
]
}
]
)json";
const char* builtin_gotcha_option_specs = R"json(
[
{
"name" : "main_thread_only",
"type" : "bool",
"description" : "Only include measurements from the main thread in results.",
"category" : "region",
"services" : [ "pthread" ],
"query" : [ { "level": "local", "where": "pthread.is_master=true" } ]
},{
"name" : "io.bytes.written",
"description" : "Report I/O bytes written",
"type" : "bool",
"category" : "metric",
"services" : [ "io" ],
"query" :
[
{ "level" : "local",
"let" : [ "ibw.bytes.written=first(sum#io.bytes.written,io.bytes.written)" ],
"select" : [ "sum(ibw.bytes.written) as \"Bytes written\" unit Byte" ]
},
{ "level" : "cross", "select":
[ "avg(sum#ibw.bytes.written) as \"Avg written\" unit Byte",
"sum(sum#ibw.bytes.written) as \"Total written\" unit Byte"
]
}
]
},{
"name" : "io.bytes.read",
"description" : "Report I/O bytes read",
"type" : "bool",
"category" : "metric",
"services" : [ "io" ],
"query" :
[
{ "level" : "local",
"let" : [ "ibr.bytes.read=first(sum#io.bytes.read,io.bytes.read)" ],
"select" : [ "sum(ibr.bytes.read) as \"Bytes read\" unit Byte" ]
},
{ "level" : "cross", "select":
[ "avg(sum#ibr.bytes.read) as \"Avg read\" unit Byte",
"sum(sum#ibr.bytes.read) as \"Total read\" unit Byte"
]
}
]
},{
"name" : "io.bytes",
"description" : "Report I/O bytes written and read",
"type" : "bool",
"category" : "metric",
"inherit" : [ "io.bytes.read", "io.bytes.written" ]
},{
"name" : "io.read.bandwidth",
"description" : "Report I/O read bandwidth",
"type" : "bool",
"category" : "metric",
"services" : [ "io" ],
"query" :
[
{ "level" : "local",
"group by" : "io.region",
"let" :
[
"irb.bytes.read=first(sum#io.bytes.read,io.bytes.read)",
"irb.time.ns=first(sum#time.duration.ns,time.duration.ns)"
],
"select" :
[
"io.region as I/O",
"ratio(irb.bytes.read,irb.time.ns,8e3) as \"Read Mbit/s\" unit Mb/s"
]
},
{ "level": "cross", "select":
[
"avg(ratio#irb.bytes_read/irb.time.ns) as \"Avg read Mbit/s\" unit Mb/s",
"max(ratio#irb.bytes_read/irb.time.ns) as \"Max read Mbit/s\" unit Mb/s"
]
}
]
},{
"name" : "io.write.bandwidth",
"description" : "Report I/O write bandwidth",
"type" : "bool",
"category" : "metric",
"services" : [ "io" ],
"query" :
[
{ "level" : "local",
"group by" : "io.region",
"let" :
[
"iwb.bytes.written=first(sum#io.bytes.written,io.bytes.written)",
"iwb.time.ns=first(sum#time.duration.ns,time.duration.ns)"
],
"select" :
[
"io.region as I/O",
"ratio(iwb.bytes.written,iwb.time.ns,8e3) as \"Write Mbit/s\" unit Mb/s"
]
},
{ "level": "cross", "select":
[
"avg(ratio#iwb.bytes.written/iwb.time) as \"Avg write Mbit/s\" unit Mb/s",
"max(ratio#iwb.bytes.written/iwb.time) as \"Max write Mbit/s\" unit Mb/s"
]
}
]
},{
"name" : "mem.highwatermark",
"description" : "Report memory high-water mark",
"type" : "bool",
"category" : "metric",
"services" : [ "alloc", "sysalloc" ],
"config" : { "CALI_ALLOC_TRACK_ALLOCATIONS": "false", "CALI_ALLOC_RECORD_HIGHWATERMARK": "true" },
"query":
[
{ "level" : "local",
"let" :
[ "mem.highwatermark.bytes = first(max#alloc.region.highwatermark,alloc.region.highwatermark)",
"mem.highwatermark = scale(mem.highwatermark.bytes,1e-6)"
],
"select" : [ "max(mem.highwatermark) as \"Allocated MB\" unit MB" ]
},
{ "level": "cross", "select": [ "max(max#mem.highwatermark) as \"Allocated MB\" unit MB" ] }
]
},{
"name" : "mem.pages",
"description" : "Memory pages used via /proc/self/statm",
"type" : "bool",
"category" : "metric",
"services" : [ "memstat" ],
"query" :
[
{ "level" : "local",
"let" :
[ "mem.vmsize = first(max#memstat.vmsize,memstat.vmsize)",
"mem.vmrss = first(max#memstat.vmrss,memstat.vmrss)",
"mem.data = first(max#memstat.data,memstat.data)"
],
"select" :
[
"max(mem.vmsize) as VmSize unit pages",
"max(mem.vmrss) as VmRSS unit pages",
"max(mem.data) as Data unit pages"
]
},
{ "level" : "cross",
"select" :
[
"max(max#mem.vmsize) as \"VmSize (max)\" unit pages",
"max(max#mem.vmrss) as \"VmRSS (max)\" unit pages",
"max(max#mem.data) as \"Data (max)\" unit pages"
]
}
]
}
]
)json";
const char* builtin_cuda_option_specs = R"json(
[
{
"name" : "profile.cuda",
"type" : "bool",
"description" : "Profile CUDA API functions",
"category" : "region",
"services" : [ "cupti" ]
},
{
"name" : "cuda.memcpy",
"description" : "Report MB copied between host and device with cudaMemcpy",
"type" : "bool",
"category" : "cuptitrace.metric",
"query" :
[
{ "level" : "local",
"let" :
[
"cuda.memcpy.dtoh=scale(cupti.memcpy.bytes,1e-6) if cupti.memcpy.kind=DtoH",
"cuda.memcpy.htod=scale(cupti.memcpy.bytes,1e-6) if cupti.memcpy.kind=HtoD"
],
"select" :
[
"sum(cuda.memcpy.htod) as \"Copy CPU->GPU\" unit MB",
"sum(cuda.memcpy.dtoh) as \"Copy GPU->CPU\" unit MB"
]
},
{ "level" : "cross", "select":
[
"avg(sum#cuda.memcpy.htod) as \"Copy CPU->GPU (avg)\" unit MB",
"max(sum#cuda.memcpy.htod) as \"Copy CPU->GPU (max)\" unit MB",
"avg(sum#cuda.memcpy.dtoh) as \"Copy GPU->CPU (avg)\" unit MB",
"max(sum#cuda.memcpy.dtoh) as \"Copy GPU->CPU (max)\" unit MB"
]
}
]
},
{
"name" : "cuda.gputime",
"description" : "Report GPU time in CUDA activities",
"type" : "bool",
"category" : "metric",
"services" : [ "cuptitrace" ],
"query" :
[
{ "level" : "local",
"select" :
[
"inclusive_scale(cupti.activity.duration,1e-9) as \"GPU time (I)\" unit sec",
]
},
{ "level" : "cross", "select":
[
"avg(iscale#cupti.activity.duration) as \"Avg GPU time/rank\" unit sec",
"min(iscale#cupti.activity.duration) as \"Min GPU time/rank\" unit sec",
"max(iscale#cupti.activity.duration) as \"Max GPU time/rank\" unit sec",
"sum(iscale#cupti.activity.duration) as \"Total GPU time\" unit sec"
]
}
]
}
]
)json";
const char* builtin_rocm_option_specs = R"json(
[
{
"name" : "profile.hip",
"type" : "bool",
"description" : "Profile HIP API functions",
"category" : "region",
"services" : [ "roctracer" ],
"config" : { "CALI_ROCTRACER_TRACE_ACTIVITIES": "false" }
},
{
"name" : "rocm.gputime",
"description" : "Report GPU time in AMD ROCm activities",
"type" : "bool",
"category" : "metric",
"services" : [ "roctracer" ],
"config" : { "CALI_ROCTRACER_TRACE_ACTIVITIES": "true", "CALI_ROCTRACER_RECORD_KERNEL_NAMES": "false" },
"query" :
[
{ "level" : "local",
"select" : [ "inclusive_scale(sum#rocm.activity.duration,1e-9) as \"GPU time (I)\" unit sec" ]
},
{ "level" : "cross",
"select" :
[
"avg(iscale#sum#rocm.activity.duration) as \"Avg GPU time/rank\" unit sec",
"min(iscale#sum#rocm.activity.duration) as \"Min GPU time/rank\" unit sec",
"max(iscale#sum#rocm.activity.duration) as \"Max GPU time/rank\" unit sec",
"sum(iscale#sum#rocm.activity.duration) as \"Total GPU time\" unit sec"
]
}
]
}
]
)json";
const char* builtin_openmp_option_specs = R"json(
[
{
"name" : "openmp.times",
"description" : "Report time spent in OpenMP work and barrier regions",
"type" : "bool",
"category" : "metric",
"services" : [ "ompt", "timestamp" ],
"query" :
[
{ "level" : "local",
"let" :
[
"t.omp.ns=first(sum#time.duration.ns,time.duration.ns)",
"t.omp.work=scale(t.omp.ns,1e-9) if omp.work",
"t.omp.sync=scale(t.omp.ns,1e-9) if omp.sync",
"t.omp.total=first(t.omp.work,t.omp.sync)"
],
"select" :
[ "sum(t.omp.work) as \"Time (work)\" unit sec",
"sum(t.omp.sync) as \"Time (barrier)\" unit sec"
]
},
{ "level" : "cross", "select":
[ "avg(sum#t.omp.work) as \"Time (work) (avg)\" unit sec",
"avg(sum#t.omp.sync) as \"Time (barrier) (avg)\" unit sec",
"sum(sum#t.omp.work) as \"Time (work) (total)\" unit sec",
"sum(sum#t.omp.sync) as \"Time (barrier) (total)\" unit sec"
]
}
]
},
{
"name" : "openmp.efficiency",
"description" : "Compute OpenMP efficiency metrics",
"type" : "bool",
"category" : "metric",
"inherit" : [ "openmp.times" ],
"query" :
[
{ "level" : "local",
"select" :
[ "inclusive_ratio(t.omp.work,t.omp.total,100.0) as \"Work %\" unit percent",
"inclusive_ratio(t.omp.sync,t.omp.total,100.0) as \"Barrier %\" unit percent"
]
},
{ "level" : "cross", "select":
[ "min(iratio#t.omp.work/t.omp.total) as \"Work % (min)\" unit percent",
"avg(iratio#t.omp.work/t.omp.total) as \"Work % (avg)\" unit percent",
"avg(iratio#t.omp.sync/t.omp.total) as \"Barrier % (avg)\" unit percent",
"max(iratio#t.omp.sync/t.omp.total) as \"Barrier % (max)\" unit percent"
]
}
]
},
{
"name" : "openmp.threads",
"description" : "Show OpenMP threads",
"type" : "bool",
"category" : "metric",
"services" : [ "ompt" ],
"query" :
[
{ "level" : "local",
"let" : [ "n.omp.threads=first(omp.num.threads)" ],
"group by": "omp.thread.id,omp.thread.type",
"select" :
[ "max(n.omp.threads) as \"#Threads\"",
"omp.thread.id as \"Thread\""
]
},
{ "level" : "cross",
"group by": "omp.thread.id,omp.thread.type",
"select" :
[ "max(max#n.omp.threads) as \"#Threads\"",
"omp.thread.id as Thread"
]
}
]
}
]
)json";
const char* builtin_libdw_option_specs = R"json(
[
{
"name" : "source.module",
"type" : "bool",
"category" : "sampling",
"description" : "Report source module (.so/.exe)",
"services" : [ "symbollookup" ],
"config" : { "CALI_SYMBOLLOOKUP_LOOKUP_MODULE": "true" },
"query":
[
{ "level": "local", "group by": "module#cali.sampler.pc",
"select": [ "module#cali.sampler.pc as \"Module\"" ]
},
{ "level": "cross", "group by": "module#cali.sampler.pc",
"select": [ "module#cali.sampler.pc as \"Module\"" ]
}
]
},
{
"name" : "source.function",
"type" : "bool",
"category" : "sampling",
"description" : "Report source function symbol names",
"services" : [ "symbollookup" ],
"config" : { "CALI_SYMBOLLOOKUP_LOOKUP_FUNCTION": "true" },
"query":
[
{ "level": "local", "group by": "source.function#cali.sampler.pc",
"select": [ "source.function#cali.sampler.pc as \"Function\"" ]
},
{ "level": "cross", "group by": "source.function#cali.sampler.pc",
"select": [ "source.function#cali.sampler.pc as \"Function\"" ]
}
]
},
{
"name" : "source.location",
"type" : "bool",
"category" : "sampling",
"description" : "Report source location (file+line)",
"services" : [ "symbollookup" ],
"config" : { "CALI_SYMBOLLOOKUP_LOOKUP_SOURCELOC": "true" },
"query":
[
{ "level": "local", "group by": "sourceloc#cali.sampler.pc",
"select": [ "sourceloc#cali.sampler.pc as \"Source\"" ]
},
{ "level": "cross", "group by": "sourceloc#cali.sampler.pc",
"select": [ "sourceloc#cali.sampler.pc as \"Source\"" ]
}
]
}
]
)json";
const char* builtin_umpire_option_specs = R"json(
[
{
"name" : "umpire.totals",
"description" : "Report umpire allocation statistics (all allocators combined)",
"type" : "bool",
"category" : "metric",
"services" : [ "umpire" ],
"config" : { "CALI_UMPIRE_PER_ALLOCATOR_STATISTICS": "false" },
"query" :
[
{ "level" : "local",
"let" :
[ "umpt.size.bytes=first(max#umpire.total.size,umpire.total.size)",
"umpt.count=first(max#umpire.total.count,umpire.total.count)",
"umpt.hwm.bytes=first(max#umpire.total.hwm,umpire.total.hwm)",
"umpt.size=scale(umpt.size.bytes,1e-6)",
"umpt.hwm=scale(umpt.hwm.bytes,1e-6)"
],
"select" :
[ "inclusive_max(umpt.size) as \"Ump MB (Total)\" unit MB",
"inclusive_max(umpt.count) as \"Ump allocs (Total)\"",
"inclusive_max(umpt.hwm) as \"Ump HWM (Total)\""
]
},
{ "level" : "cross",
"select" :