Skip to content

Commit c0f26f3

Browse files
committed
Enable/disable benchmarking through config
Signed-off-by: Victor Chang <vicchang@nvidia.com>
1 parent ff44e11 commit c0f26f3

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

applications/distributed/ucx/ucx_endoscopy_tool_tracking/cpp/endoscopy_tool_tracking.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ extensions:
2121
- libgxf_serialization.so
2222
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so
2323

24+
application:
25+
title: Endoscopy Tool Tracking - UCX
26+
version: 1.0
27+
inputFormats: []
28+
outputFormats: ["screen"]
29+
benchmarking: true # default: false, true to enable Data Flow Benchmarking, false otherwise
30+
2431
replayer:
2532
basename: "surgical_video"
2633
frame_rate: 0 # as specified in timestamps
27-
repeat: true # default: false
34+
repeat: false # default: false
2835
realtime: true # default: true
2936
count: 0 # default: 0 (no frame count restriction)
3037

applications/distributed/ucx/ucx_endoscopy_tool_tracking/cpp/main.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,23 @@ bool parse_arguments(int argc, char** argv, std::string& data_path, std::string&
178178
return true;
179179
}
180180

181+
/** Helper function to parse fragment mode and benchmarking settings from the configuration file */
182+
void parse_config(const std::string& config_path, bool& benchmarking) {
183+
auto config = holoscan::Config(config_path);
184+
auto& yaml_nodes = config.yaml_nodes();
185+
for (const auto& yaml_node : yaml_nodes) {
186+
try {
187+
auto application = yaml_node["application"];
188+
if (application.IsMap()) {
189+
benchmarking = application["benchmarking"].as<bool>();
190+
}
191+
} catch (std::exception& e) {
192+
HOLOSCAN_LOG_ERROR("Error parsing configuration file: {}", e.what());
193+
benchmarking = false;
194+
}
195+
}
196+
}
197+
181198
/** Main function */
182199
int main(int argc, char** argv) {
183200
std::string config_path = "";
@@ -207,15 +224,25 @@ int main(int argc, char** argv) {
207224
}
208225
}
209226

227+
bool benchmarking = false;
228+
parse_config(config_path, benchmarking);
229+
210230
auto app = holoscan::make_application<App>();
211231
app->config(config_path);
212232
app->set_datapath(data_directory);
213233

214-
auto trackers = app->track_distributed();
234+
std::unordered_map<std::string, DataFlowTracker*> trackers;
235+
if (benchmarking) {
236+
trackers = app->track_distributed();
237+
}
238+
215239
app->run();
216-
for (const auto& [name, tracker] : trackers) {
217-
std::cout << "Fragment: " << name << std::endl;
218-
tracker->print();
240+
241+
if (benchmarking) {
242+
for (const auto& [name, tracker] : trackers) {
243+
std::cout << "Fragment: " << name << std::endl;
244+
tracker->print();
245+
}
219246
}
220247
return 0;
221248
}

0 commit comments

Comments
 (0)