Skip to content

Commit 18b7b45

Browse files
authored
Hatchet profile recipe improvements (LLNL#508)
* Update hatchet profile configs * Improve cali-query help
1 parent f996634 commit 18b7b45

File tree

6 files changed

+54
-56
lines changed

6 files changed

+54
-56
lines changed

src/caliper/controllers/HatchetRegionProfileController.cpp

+45-28
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ check_args(const cali::ConfigManager::Options& opts) {
9898
cali::ChannelController*
9999
make_controller(const char* name, const config_map_t& initial_cfg, const cali::ConfigManager::Options& opts)
100100
{
101-
std::string format = opts.get("output.format", "json-split").to_string();
101+
std::string format = opts.get("output.format", "cali").to_string();
102102

103103
if (format == "hatchet")
104-
format = "json-split";
104+
format = "cali";
105105

106106
if (!(format == "json-split" || format == "json" || format == "cali")) {
107107
format = "json-split";
@@ -113,32 +113,49 @@ make_controller(const char* name, const config_map_t& initial_cfg, const cali::C
113113
return new HatchetRegionProfileController(name, initial_cfg, opts, format);
114114
}
115115

116-
const char* controller_spec =
117-
"{"
118-
" \"name\" : \"hatchet-region-profile\","
119-
" \"description\" : \"Record a region time profile for processing with hatchet\","
120-
" \"categories\" : [ \"adiak\", \"metric\", \"output\", \"region\", \"event\" ],"
121-
" \"services\" : [ \"aggregate\", \"event\", \"timer\" ],"
122-
" \"config\" : "
123-
" { \"CALI_CHANNEL_FLUSH_ON_EXIT\" : \"false\","
124-
" \"CALI_EVENT_ENABLE_SNAPSHOT_INFO\" : \"false\","
125-
" \"CALI_TIMER_UNIT\" : \"sec\""
126-
" },"
127-
" \"defaults\" : { \"node.order\": \"true\" },"
128-
" \"options\": "
129-
" ["
130-
" { "
131-
" \"name\": \"output.format\","
132-
" \"type\": \"string\","
133-
" \"description\": \"Output format ('hatchet', 'cali', 'json')\""
134-
" },"
135-
" { "
136-
" \"name\": \"use.mpi\","
137-
" \"type\": \"bool\","
138-
" \"description\": \"Merge results into a single output stream in MPI programs\""
139-
" }"
140-
" ]"
141-
"}";
116+
const char* controller_spec = R"json(
117+
{
118+
"name" : "hatchet-region-profile",
119+
"description" : "Record a region time profile for processing with hatchet",
120+
"categories" : [ "adiak", "metric", "output", "region", "event" ],
121+
"services" : [ "aggregate", "event", "timer" ],
122+
"config" :
123+
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
124+
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
125+
"CALI_TIMER_UNIT" : "sec"
126+
},
127+
"defaults" : { "node.order": "true" },
128+
"options":
129+
[
130+
{
131+
"name": "output.format",
132+
"type": "string",
133+
"description": "Output format ('hatchet', 'cali', 'json')"
134+
},
135+
{
136+
"name": "use.mpi",
137+
"type": "bool",
138+
"description": "Merge results into a single output stream in MPI programs"
139+
},
140+
{
141+
"name": "time.inclusive",
142+
"type": "bool",
143+
"category": "metric",
144+
"description": "Add inclusive time metric",
145+
"query":
146+
[
147+
{
148+
"level" : "local",
149+
"select" :
150+
[
151+
{ "expr": "inclusive_scale(sum#time.duration.ns,1e-9)", "as": "time (inc)", "unit": "sec" }
152+
]
153+
}
154+
]
155+
}
156+
]
157+
}
158+
)json";
142159

143160
} // namespace [anonymous]
144161

src/caliper/controllers/HatchetSampleProfileController.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ check_args(const cali::ConfigManager::Options& opts) {
125125
cali::ChannelController*
126126
make_controller(const char* name, const config_map_t& initial_cfg, const cali::ConfigManager::Options& opts)
127127
{
128-
std::string format = opts.get("output.format", "json-split").to_string();
128+
std::string format = opts.get("output.format", "cali").to_string();
129129

130130
if (format == "hatchet")
131-
format = "json-split";
131+
format = "cali";
132132

133133
if (!(format == "json-split" || format == "json" || format == "cali")) {
134134
format = "json-split";

src/tools/cali-query/cali-query.cpp

+4-23
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace
6060
"ATTRIBUTES"
6161
},
6262
{ "expand", "expand", 'e', false,
63-
"Expand context records and print the selected attributes (default: all)",
63+
"Print records as comma-separated key=value lists",
6464
nullptr
6565
},
6666
{ "attributes", "print-attributes", 0, true,
@@ -80,7 +80,7 @@ namespace
8080
"STRING"
8181
},
8282
{ "table", "table", 't', false,
83-
"Print attributes in human-readable table form",
83+
"Print records in human-readable table form",
8484
nullptr
8585
},
8686
{ "tree" , "tree", 'T', false,
@@ -111,20 +111,16 @@ namespace
111111
"Set Caliper configuration for profiling cali-query",
112112
"CALIPER-CONFIG"
113113
},
114-
{ "caliper-config-vars", "caliper-config-vars", 0, true,
115-
"Caliper configuration flags (for cali-query profiling)",
116-
"KEY=VALUE,..."
117-
},
118114
{ "verbose", "verbose", 'v', false, "Be verbose.", nullptr },
119115
{ "version", "version", 'V', false, "Print version number", nullptr },
120116
{ "output", "output", 'o', true, "Set the output file name", "FILE" },
121117
{ "help", "help", 'h', true, "Print help message", nullptr },
122118
{ "list-attributes", "list-attributes", 0, false,
123-
"Extract and list attributes in Caliper stream instead of snapshot records",
119+
"List attribute info. Use with -j, -t, etc. to select output format.",
124120
nullptr
125121
},
126122
{ "list-globals", "list-globals", 'G', false,
127-
"Extract and list global per-run attributes",
123+
"List global run metadata. Use with -j, -t, etc. to select output format.",
128124
nullptr
129125
},
130126
Args::Table::Terminator
@@ -203,21 +199,6 @@ void setup_caliper_config(const Args& args)
203199

204200
if (args.is_set("verbose"))
205201
cali_config_preset("CALI_LOG_VERBOSITY", "1");
206-
207-
std::vector<std::string> config_list =
208-
StringConverter(args.get("caliper-config-vars")).to_stringlist();
209-
210-
for (const std::string entry : config_list) {
211-
auto p = entry.find('=');
212-
213-
if (p == std::string::npos) {
214-
std::cerr << "cali-query: error: invalid Caliper configuration flag format \""
215-
<< entry << "\" (missing \"=\")" << std::endl;
216-
continue;
217-
}
218-
219-
cali_config_set(entry.substr(0, p).c_str(), entry.substr(p+1).c_str());
220-
}
221202
}
222203

223204
//

test/ci_app_tests/test_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_jsontree(self):
107107
def test_hatchetcontroller(self):
108108
""" Test hatchet-region-profile controller """
109109

110-
target_cmd = [ './ci_test_macros', '0', 'hatchet-region-profile,use.mpi=false,output=stdout,node.order=false' ]
110+
target_cmd = [ './ci_test_macros', '0', 'hatchet-region-profile,use.mpi=false,output=stdout,output.format=json-split,node.order=false' ]
111111

112112
caliper_config = {
113113
'CALI_LOG_VERBOSITY' : '0'

test/ci_app_tests/test_ompt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CaliperOpenMPMetrics(unittest.TestCase):
99
""" Caliper OpenMP/OMPT test case """
1010

1111
def test_ioservice(self):
12-
target_cmd = [ './ci_test_openmp', 'hatchet-region-profile,openmp.times,output=stdout' ]
12+
target_cmd = [ './ci_test_openmp', 'hatchet-region-profile,openmp.times,output=stdout,output.format=json-split' ]
1313

1414
caliper_config = {
1515
'CALI_LOG_VERBOSITY' : '0'

test/ci_app_tests/test_symbollookup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_sampler_symbollookup(self):
3636
'region', 'loop' }))
3737

3838
def test_hatchet_sample_profile_lookup(self):
39-
target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output=stdout,callpath=false,source.location=true,source.module=true)' ]
39+
target_cmd = [ './ci_test_macros', '5000', 'hatchet-sample-profile(use.mpi=false,output.format=json-split,output=stdout,callpath=false,source.location=true,source.module=true)' ]
4040

4141
caliper_config = {
4242
'CALI_LOG_VERBOSITY' : '0'

0 commit comments

Comments
 (0)