Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,22 @@ ovms_cc_library(
name = "libovms_version",
hdrs = ["version.hpp"],
srcs = [],
deps = ["//third_party:openvino",],
deps = [],
visibility = ["//visibility:public",],
)
ovms_cc_library(
name = "libovms_version_impl",
srcs = ["version.cpp"],
deps = [
":libovms_version",
"//third_party:openvino",
] + select({
"//:not_disable_mediapipe": ["//third_party:genai"],
"//conditions:default": [],
}),
additional_copts = COPTS_MEDIAPIPE,
visibility = ["//visibility:public",],
alwayslink = 1,
)
ovms_cc_library(
name = "network_utils",
Expand Down Expand Up @@ -641,6 +655,7 @@ ovms_cc_library(
"libovmstimer",
"tfs_utils",
"libovms_version",
"libovms_version_impl",
"serialization_common",
"libovmsprofiler",
"libovmsstatus",
Expand Down
2 changes: 1 addition & 1 deletion src/capi_frontend/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ DLL_PUBLIC OVMS_Status* OVMS_ServerMetadata(OVMS_Server* server, OVMS_Metadata**
doc->AddMember("name", PROJECT_NAME, doc->GetAllocator());
doc->AddMember("version", PROJECT_VERSION, doc->GetAllocator());
rapidjson::Value ovVersion;
ovVersion.SetString(OPENVINO_NAME, doc->GetAllocator());
ovVersion.SetString(ovms::getOpenVINOVersion(), doc->GetAllocator());
doc->AddMember("ov_version", std::move(ovVersion), doc->GetAllocator());
*metadata = reinterpret_cast<OVMS_Metadata*>(doc);
return nullptr;
Expand Down
7 changes: 5 additions & 2 deletions src/cli_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,11 @@ std::variant<bool, std::pair<int, std::string>> CLIParser::parse(int argc, char*
std::string project_name(PROJECT_NAME);
std::string project_version(PROJECT_VERSION);
ss << project_name + " " + project_version << std::endl;
ss << "OpenVINO backend " << OPENVINO_NAME << std::endl;
ss << "OpenVINO GenAI backend " << GENAI_NAME << std::endl;
ss << "OpenVINO backend " << ovms::getOpenVINOVersion() << std::endl;
const char* genaiVersion = ovms::getGenAIVersion();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why couldnt getGenAIVersion return std::string? This way you dont need to rely on zero-terminated string, but simply call genaiVersion.empty()

if (genaiVersion[0] != '\0') {
ss << "OpenVINO GenAI backend " << genaiVersion << std::endl;
}
ss << "Bazel build flags: " << BAZEL_BUILD_FLAGS << std::endl;
#pragma warning(pop)
return std::make_pair(OVMS_EX_OK, ss.str());
Expand Down
7 changes: 6 additions & 1 deletion src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ static void logConfig(const Config& config) {
std::string project_name(PROJECT_NAME);
std::string project_version(PROJECT_VERSION);
SPDLOG_INFO(project_name + " " + project_version);
SPDLOG_INFO("OpenVINO backend {}", OPENVINO_NAME);
SPDLOG_INFO("OpenVINO backend {}", ovms::getOpenVINOVersion());
const char* genaiVersion = ovms::getGenAIVersion();
if (genaiVersion[0] != '\0') {
SPDLOG_INFO("OpenVINO GenAI backend {}", genaiVersion);
}
SPDLOG_DEBUG("Bazel build flags: {}", BAZEL_BUILD_FLAGS);
SPDLOG_DEBUG("CLI parameters passed to ovms server");
if (config.getServerSettings().serverMode == HF_PULL_MODE) {
SPDLOG_DEBUG("source_model: {}", config.getServerSettings().hfSettings.sourceModel);
Expand Down
4 changes: 2 additions & 2 deletions src/test/c_api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ TEST(CAPIServerMetadata, Basic) {
ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_SerializeMetadataToString(metadata, nullptr, &size), StatusCode::NONEXISTENT_PTR);
ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_SerializeMetadataToString(metadata, &json, nullptr), StatusCode::NONEXISTENT_PTR);
ASSERT_CAPI_STATUS_NULL(OVMS_SerializeMetadataToString(metadata, &json, &size));
ASSERT_EQ(std::string(json), std::string("{\"name\":\"" + std::string(PROJECT_NAME) + "\",\"version\":\"" + std::string(PROJECT_VERSION) + "\",\"ov_version\":\"" + std::string(OPENVINO_NAME) + "\"}"));
ASSERT_EQ(std::string(json), std::string("{\"name\":\"" + std::string(PROJECT_NAME) + "\",\"version\":\"" + std::string(PROJECT_VERSION) + "\",\"ov_version\":\"" + std::string(ovms::getOpenVINOVersion()) + "\"}"));
ASSERT_EQ(size, std::strlen(json));
OVMS_StringFree(json);
const char* pointer = "/name";
Expand All @@ -362,7 +362,7 @@ TEST(CAPIServerMetadata, Basic) {

pointer = "/ov_version";
ASSERT_CAPI_STATUS_NULL(OVMS_MetadataFieldByPointer(metadata, pointer, &value, &size));
ASSERT_EQ(std::string(value), std::string(OPENVINO_NAME));
ASSERT_EQ(std::string(value), std::string(ovms::getOpenVINOVersion()));
ASSERT_EQ(size, std::strlen(value));
OVMS_StringFree(value);

Expand Down
34 changes: 34 additions & 0 deletions src/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//*****************************************************************************
// Copyright 2026 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include "version.hpp"

#include <openvino/openvino.hpp>
#if (MEDIAPIPE_DISABLE == 0)
#include <openvino/genai/version.hpp>
#endif

namespace ovms {
const char* getOpenVINOVersion() {
return ov::get_openvino_version().buildNumber;
}
const char* getGenAIVersion() {
#if (MEDIAPIPE_DISABLE == 0)
return ov::genai::get_version().buildNumber;
#else
return "";
#endif
}
} // namespace ovms
11 changes: 5 additions & 6 deletions src/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************

#include <openvino/openvino.hpp>
#include <openvino/genai/version.hpp>

#ifndef SRC_VERSION_HPP_
#define SRC_VERSION_HPP_
#define PROJECT_NAME "OpenVINO Model Server"
#define PROJECT_VERSION "REPLACE_PROJECT_VERSION"
#define OPENVINO_NAME ov::get_openvino_version().buildNumber
#define GENAI_NAME ov::genai::get_version().buildNumber
#define BAZEL_BUILD_FLAGS "REPLACE_BAZEL_BUILD_FLAGS"

namespace ovms {
const char* getOpenVINOVersion();
const char* getGenAIVersion();
} // namespace ovms
#endif // SRC_VERSION_HPP_
2 changes: 1 addition & 1 deletion windows_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ set "runTest=%cd%\bazel-bin\src\ovms_test.exe --gtest_filter=!gtestFilter! > win

:: Setting PATH environment variable based on default windows node settings: Added ovms_windows specific python settings and c:/opt and removed unused Nvidia and OCL specific tools.
:: When changing the values here you can print the node default PATH value and base your changes on it.
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;C:\opt\curl-8.18.0_4-win64-mingw\bin;%PATH%;"
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;C:\opt\curl-8.18.0_4-win64-mingw\bin;c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;%PATH%;"
set "setPythonPath=%cd%\bazel-out\x64_windows-opt\bin\src\python\binding"
set "BAZEL_SH=C:\opt\msys64\usr\bin\bash.exe"

Expand Down
Loading