mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-22 19:23:30 +00:00
* Enabled multi-threading for OpenVino EP ->Enabled support for concurrent_session_runs *Run UEP using concurrent_session_runs > 1 *Enabled support for ORT_PARALLEL ExecutionMode ->Documentation Added for Enabling MultiThreading Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com> * Minor Fixes added *Configure the value of nireq during Runtime *Documentation typos rectified and details added for Multi_Threaded Inference Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com> * Some checks added for this fix *Added checks to invalidate wrong nireq value and assigned it to default value of 8 *Added new config options for enable_vpu_fast_compile which were changed w.r.t OpenVINO_2021.1 Release Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com>
76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
// onnxruntime dependencies
|
|
#include <core/session/onnxruntime_c_api.h>
|
|
#include <random>
|
|
#include "command_args_parser.h"
|
|
#include "performance_runner.h"
|
|
#include <google/protobuf/stubs/common.h>
|
|
|
|
using namespace onnxruntime;
|
|
const OrtApi* g_ort = NULL;
|
|
|
|
#ifdef _WIN32
|
|
int real_main(int argc, wchar_t* argv[]) {
|
|
#else
|
|
int real_main(int argc, char* argv[]) {
|
|
#endif
|
|
g_ort = OrtGetApiBase()->GetApi(ORT_API_VERSION);
|
|
perftest::PerformanceTestConfig test_config;
|
|
if (!perftest::CommandLineParser::ParseArguments(test_config, argc, argv)) {
|
|
perftest::CommandLineParser::ShowUsage();
|
|
return -1;
|
|
}
|
|
Ort::Env env{nullptr};
|
|
{
|
|
bool failed = false;
|
|
ORT_TRY {
|
|
OrtLoggingLevel logging_level = test_config.run_config.f_verbose
|
|
? ORT_LOGGING_LEVEL_VERBOSE
|
|
: ORT_LOGGING_LEVEL_WARNING;
|
|
env = Ort::Env(logging_level, "Default");
|
|
}
|
|
ORT_CATCH(const Ort::Exception& e) {
|
|
ORT_HANDLE_EXCEPTION([&]() {
|
|
fprintf(stderr, "Error creating environment: %s \n", e.what());
|
|
failed = true;
|
|
});
|
|
}
|
|
|
|
if (failed)
|
|
return -1;
|
|
}
|
|
std::random_device rd;
|
|
perftest::PerformanceRunner perf_runner(env, test_config, rd);
|
|
auto status = perf_runner.Run();
|
|
if (!status.IsOK()) {
|
|
printf("Run failed:%s\n", status.ErrorMessage().c_str());
|
|
return -1;
|
|
}
|
|
|
|
perf_runner.SerializeResult();
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef _WIN32
|
|
int wmain(int argc, wchar_t* argv[]) {
|
|
#else
|
|
int main(int argc, char* argv[]) {
|
|
#endif
|
|
int retval = -1;
|
|
ORT_TRY {
|
|
retval = real_main(argc, argv);
|
|
}
|
|
ORT_CATCH(const std::exception& ex) {
|
|
ORT_HANDLE_EXCEPTION([&]() {
|
|
fprintf(stderr, "%s\n", ex.what());
|
|
retval = -1;
|
|
});
|
|
}
|
|
|
|
::google::protobuf::ShutdownProtobufLibrary();
|
|
|
|
return retval;
|
|
}
|