Skip to content

Commit ff53426

Browse files
authored
Update cuda and rocm controllers (LLNL#524)
1 parent b4553b9 commit ff53426

4 files changed

+67
-61
lines changed

src/caliper/controllers/CudaActivityProfileController.cpp

+34-32
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CudaActivityProfileController : public cali::ChannelController
6565
"*,scale(cupti.activity.duration,1e-9) as \"time (gpu)\" unit sec"
6666
" ,scale(sum#cupti.host.duration,1e-9) as \"time\" unit sec"
6767
},
68-
{ "group by", "prop:nested,cupti.kernel.name,cupti.activity.kind,mpi.rank" },
68+
{ "group by", "path,cupti.kernel.name,cupti.activity.kind,mpi.rank" },
6969
{ "format", format }
7070
});
7171
} else {
@@ -76,7 +76,7 @@ class CudaActivityProfileController : public cali::ChannelController
7676
{ "select",
7777
"*,scale(cupti.activity.duration,1e-9) as \"time (gpu)\" unit sec"
7878
" ,scale(sum#cupti.host.duration,1e-9) as \"time\" unit sec" },
79-
{ "group by", "prop:nested,cupti.kernel.name,cupti.activity.kind" },
79+
{ "group by", "path,cupti.kernel.name,cupti.activity.kind" },
8080
{ "format", format }
8181
});
8282
}
@@ -90,7 +90,7 @@ std::string
9090
check_args(const cali::ConfigManager::Options& opts) {
9191
// Check if output.format is valid
9292

93-
std::string format = opts.get("output.format", "json-split").to_string();
93+
std::string format = opts.get("output.format", "cali").to_string();
9494
std::set<std::string> allowed_formats = { "cali", "json", "json-split", "hatchet" };
9595

9696
if (allowed_formats.find(format) == allowed_formats.end())
@@ -102,46 +102,48 @@ check_args(const cali::ConfigManager::Options& opts) {
102102
cali::ChannelController*
103103
make_controller(const char* name, const config_map_t& initial_cfg, const cali::ConfigManager::Options& opts)
104104
{
105-
std::string format = opts.get("output.format", "json-split").to_string();
105+
std::string format = opts.get("output.format", "cali").to_string();
106106

107107
if (format == "hatchet")
108108
format = "json-split";
109109

110110
if (!(format == "json-split" || format == "json" || format == "cali")) {
111-
format = "json-split";
112-
Log(0).stream() << "hatchet-region-profile: Unknown output format \"" << format
113-
<< "\". Using json-split."
111+
format = "cali";
112+
Log(0).stream() << "cuda-activity-profile: Unknown output format \"" << format
113+
<< "\". Using cali."
114114
<< std::endl;
115115
}
116116

117117
return new CudaActivityProfileController(name, initial_cfg, opts, format);
118118
}
119119

120-
const char* controller_spec =
121-
"{"
122-
" \"name\" : \"cuda-activity-profile\","
123-
" \"description\" : \"Record CUDA activities and a write profile\","
124-
" \"categories\" : [ \"adiak\", \"metric\", \"cuptitrace.metric\", \"output\", \"region\", \"event\" ],"
125-
" \"services\" : [ \"aggregate\", \"cupti\", \"cuptitrace\", \"event\" ],"
126-
" \"config\" : "
127-
" { \"CALI_CHANNEL_FLUSH_ON_EXIT\" : \"false\","
128-
" \"CALI_EVENT_ENABLE_SNAPSHOT_INFO\" : \"false\","
129-
" \"CALI_CUPTITRACE_SNAPSHOT_DURATION\" : \"true\""
130-
" },"
131-
" \"options\": "
132-
" ["
133-
" { "
134-
" \"name\": \"output.format\","
135-
" \"type\": \"string\","
136-
" \"description\": \"Output format ('hatchet', 'cali', 'json')\""
137-
" },"
138-
" { "
139-
" \"name\": \"use.mpi\","
140-
" \"type\": \"bool\","
141-
" \"description\": \"Merge results into a single output stream in MPI programs\""
142-
" }"
143-
" ]"
144-
"}";
120+
const char* controller_spec = R"json(
121+
{
122+
"name" : "cuda-activity-profile",
123+
"description" : "Record CUDA activities and a write profile",
124+
"categories" : [ "adiak", "metric", "cuptitrace.metric", "output", "region", "event" ],
125+
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
126+
"config" :
127+
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
128+
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
129+
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
130+
},
131+
"defaults" : { "node.order": "true" },
132+
"options":
133+
[
134+
{
135+
"name": "output.format",
136+
"type": "string",
137+
"description": "Output format ('hatchet', 'cali', 'json')"
138+
},
139+
{
140+
"name": "use.mpi",
141+
"type": "bool",
142+
"description": "Merge results into a single output stream in MPI programs"
143+
}
144+
]
145+
};
146+
)json";
145147

146148
} // namespace [anonymous]
147149

src/caliper/controllers/CudaActivityReportController.cpp

+28-26
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CudaActivityReportController : public cali::ChannelController
4444
",max(iscale#cupti.activity.duration) as \"Max GPU Time\""
4545
",ratio(iscale#cupti.activity.duration,iscale#sum#cupti.host.duration,100.0) as \"GPU %\"";
4646

47-
std::string groupby = "prop:nested";
47+
std::string groupby = "path";
4848

4949
if (opts.is_enabled("show_kernels")) {
5050
groupby += ",cupti.kernel.name";
@@ -116,31 +116,33 @@ make_controller(const char* name, const config_map_t& initial_cfg, const cali::C
116116
return new CudaActivityReportController(use_mpi(opts), name, initial_cfg, opts);
117117
}
118118

119-
const char* controller_spec =
120-
"{"
121-
" \"name\" : \"cuda-activity-report\","
122-
" \"description\" : \"Record and print CUDA activities (kernel executions, memcopies, etc.)\","
123-
" \"categories\" : [ \"output\", \"region\", \"cuptitrace.metric\", \"treeformatter\", \"event\" ],"
124-
" \"services\" : [ \"aggregate\", \"cupti\", \"cuptitrace\", \"event\" ],"
125-
" \"config\" : "
126-
" { \"CALI_CHANNEL_FLUSH_ON_EXIT\" : \"false\","
127-
" \"CALI_EVENT_ENABLE_SNAPSHOT_INFO\" : \"false\","
128-
" \"CALI_CUPTITRACE_SNAPSHOT_DURATION\" : \"true\""
129-
" },"
130-
" \"options\": "
131-
" ["
132-
" {"
133-
" \"name\": \"aggregate_across_ranks\","
134-
" \"type\": \"bool\","
135-
" \"description\": \"Aggregate results across MPI ranks\""
136-
" },"
137-
" {"
138-
" \"name\": \"show_kernels\","
139-
" \"type\": \"bool\","
140-
" \"description\": \"Show kernel names\""
141-
" }"
142-
" ]"
143-
"}";
119+
const char* controller_spec = R"json(
120+
{
121+
"name" : "cuda-activity-report",
122+
"description" : "Record and print CUDA activities (kernel executions, memcopies, etc.)",
123+
"categories" : [ "output", "region", "cuptitrace.metric", "treeformatter", "event" ],
124+
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
125+
"config" :
126+
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
127+
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
128+
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
129+
},
130+
"defaults" : { "order_as_visited": "true" },
131+
"options":
132+
[
133+
{
134+
"name": "aggregate_across_ranks",
135+
"type": "bool",
136+
"description": "Aggregate results across MPI ranks"
137+
},
138+
{
139+
"name": "show_kernels",
140+
"type": "bool",
141+
"description": "Show kernel names"
142+
}
143+
]
144+
}
145+
)json";
144146

145147
} // namespace [anonymous]
146148

src/caliper/controllers/ROCmActivityProfileController.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ std::string
9090
check_args(const cali::ConfigManager::Options& opts) {
9191
// Check if output.format is valid
9292

93-
std::string format = opts.get("output.format", "json-split").to_string();
93+
std::string format = opts.get("output.format", "cali").to_string();
9494
std::set<std::string> allowed_formats = { "cali", "json", "json-split", "hatchet" };
9595

9696
if (allowed_formats.find(format) == allowed_formats.end())
@@ -102,13 +102,13 @@ check_args(const cali::ConfigManager::Options& opts) {
102102
cali::ChannelController*
103103
make_controller(const char* name, const config_map_t& initial_cfg, const cali::ConfigManager::Options& opts)
104104
{
105-
std::string format = opts.get("output.format", "json-split").to_string();
105+
std::string format = opts.get("output.format", "cali").to_string();
106106

107107
if (format == "hatchet")
108108
format = "json-split";
109109

110110
if (!(format == "json-split" || format == "json" || format == "cali")) {
111-
format = "json-split";
111+
format = "cali";
112112
Log(0).stream() << "hatchet-region-profile: Unknown output format \"" << format
113113
<< "\". Using json-split."
114114
<< std::endl;
@@ -130,6 +130,7 @@ const char* controller_spec = R"json(
130130
"CALI_ROCTRACER_RECORD_KERNEL_NAMES": "true",
131131
"CALI_ROCTRACER_SNAPSHOT_DURATION" : "false"
132132
},
133+
"defaults" : { "node.order": "true" },
133134
"options":
134135
[
135136
{

src/caliper/controllers/ROCmActivityReportController.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const char* controller_spec = R"json(
127127
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
128128
"CALI_ROCTRACER_TRACE_ACTIVITIES" : "true"
129129
},
130+
"defaults" : { "order_as_visited": "true" },
130131
"options":
131132
[
132133
{

0 commit comments

Comments
 (0)