Benchmark sort opt (#12350)
* Benchmark_app python and c/c++ script add op profiling feature * Fix compile bug about benchmark c/c++ op profiling * Fix Compile Bug * Fix issue in PR#12350 : 1. report_type info update; 2. priority of -pc and -pcsort; 3.align format between c++ and python; 4.check 'proportion' for 0 and print N/A; 5.detect the confusing print info * Fix 8/17 review suggestion * Fix 8/23 suggestion * Fix the clang-format issue * Fix the win-cc issue * Fix win-cc issue about conversion from 'double' to 'float', possible loss of data * Push PR by ODT group account Co-authored-by: Chen Peter <peter.chen@intel.com> Co-authored-by: Fiona Zhao <fiona.zhao@intel.com>
This commit is contained in:
26
samples/cpp/benchmark_app/main.cpp
Normal file → Executable file
26
samples/cpp/benchmark_app/main.cpp
Normal file → Executable file
@@ -66,9 +66,9 @@ bool parse_and_check_command_line(int argc, char* argv[]) {
|
||||
"(those options can be used in OpenVINO together), but a benchmark_app UI rule.");
|
||||
}
|
||||
if (!FLAGS_report_type.empty() && FLAGS_report_type != noCntReport && FLAGS_report_type != averageCntReport &&
|
||||
FLAGS_report_type != detailedCntReport) {
|
||||
FLAGS_report_type != detailedCntReport && FLAGS_report_type != sortDetailedCntReport) {
|
||||
std::string err = "only " + std::string(noCntReport) + "/" + std::string(averageCntReport) + "/" +
|
||||
std::string(detailedCntReport) +
|
||||
std::string(detailedCntReport) + "/" + std::string(sortDetailedCntReport) +
|
||||
" report types are supported (invalid -report_type option value)";
|
||||
throw std::logic_error(err);
|
||||
}
|
||||
@@ -77,6 +77,12 @@ bool parse_and_check_command_line(int argc, char* argv[]) {
|
||||
throw std::logic_error("only " + std::string(detailedCntReport) + " report type is supported for MULTI device");
|
||||
}
|
||||
|
||||
if (!FLAGS_pcsort.empty() && FLAGS_pcsort != "sort" && FLAGS_pcsort != "no_sort" && FLAGS_pcsort != "simple_sort") {
|
||||
std::string pcsort_err = std::string("Incorrect performance count sort . Please set -pcsort option to ") +
|
||||
std::string("'sort', 'no_sort', 'simple_sort'.");
|
||||
throw std::logic_error(pcsort_err);
|
||||
}
|
||||
|
||||
bool isNetworkCompiled = fileExt(FLAGS_m) == "blob";
|
||||
bool isPrecisionSet = !(FLAGS_ip.empty() && FLAGS_op.empty() && FLAGS_iop.empty());
|
||||
if (isNetworkCompiled && isPrecisionSet) {
|
||||
@@ -304,7 +310,8 @@ int main(int argc, char* argv[]) {
|
||||
(device_config.at(ov::enable_profiling.name()).as<bool>())) {
|
||||
slog::warn << "Performance counters for " << device
|
||||
<< " device is turned on. To print results use -pc option." << slog::endl;
|
||||
} else if (FLAGS_report_type == detailedCntReport || FLAGS_report_type == averageCntReport) {
|
||||
} else if (FLAGS_report_type == detailedCntReport || FLAGS_report_type == averageCntReport ||
|
||||
FLAGS_report_type == sortDetailedCntReport) {
|
||||
slog::warn << "Turn on performance counters for " << device << " device since report type is "
|
||||
<< FLAGS_report_type << "." << slog::endl;
|
||||
device_config.emplace(ov::enable_profiling(true));
|
||||
@@ -312,6 +319,10 @@ int main(int argc, char* argv[]) {
|
||||
slog::warn << "Turn on performance counters for " << device << " device due to execution graph dumping."
|
||||
<< slog::endl;
|
||||
device_config.emplace(ov::enable_profiling(true));
|
||||
} else if (!FLAGS_pcsort.empty()) {
|
||||
slog::warn << "Turn on sorted performance counters for " << device << " device since pcsort is"
|
||||
<< FLAGS_pcsort << "." << slog::endl;
|
||||
device_config.emplace(ov::enable_profiling(true));
|
||||
} else {
|
||||
// set to default value
|
||||
device_config.emplace(ov::enable_profiling(FLAGS_pc));
|
||||
@@ -1171,7 +1182,14 @@ int main(int argc, char* argv[]) {
|
||||
std::vector<std::vector<ov::ProfilingInfo>> perfCounts;
|
||||
for (size_t ireq = 0; ireq < nireq; ireq++) {
|
||||
auto reqPerfCounts = inferRequestsQueue.requests[ireq]->get_performance_counts();
|
||||
if (FLAGS_pc) {
|
||||
if (!FLAGS_pcsort.empty()) {
|
||||
slog::info << "Sort performance counts for " << ireq << "-th infer request:" << slog::endl;
|
||||
printPerformanceCountsSort(reqPerfCounts,
|
||||
std::cout,
|
||||
getFullDeviceName(core, FLAGS_d),
|
||||
FLAGS_pcsort,
|
||||
false);
|
||||
} else if (FLAGS_pc) {
|
||||
slog::info << "Performance counts for " << ireq << "-th infer request:" << slog::endl;
|
||||
printPerformanceCounts(reqPerfCounts, std::cout, getFullDeviceName(core, FLAGS_d), false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user