Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 2.0 and 2024.0 compatibility #92

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a316c51
update upstream openvino so that it updates to api 2.0
rahulchaphalkar Feb 8, 2024
7362b75
formatting dynamic.rs
rahulchaphalkar Mar 29, 2024
f3615d3
fix runtime linking
rahulchaphalkar Mar 29, 2024
1ad9f22
clippy warnings fix
rahulchaphalkar Mar 29, 2024
6dd9f4f
change xtask/codegen to relative path
rahulchaphalkar Mar 29, 2024
8cb7fe2
cargo fmt
rahulchaphalkar Mar 29, 2024
08fdbda
fix bindgen wchar_t issue
rahulchaphalkar Mar 29, 2024
c560e51
New branch
BTOdell Apr 3, 2024
18878b3
Merge pull request #1 from rahulchaphalkar/openvino-API-2.0
BTOdell Apr 3, 2024
65fbec4
Update to OpenVINO 2024.0.0
BTOdell Apr 3, 2024
beef339
Fix finding of OpenVINO 2024.0.0 on Windows.
BTOdell Apr 3, 2024
4cd2cc5
Fixed linking on Windows.
BTOdell Apr 3, 2024
5605c43
Update OpenVINO versions for GitHub Actions.
BTOdell Apr 3, 2024
5296fa9
Fix C string memory leaks.
BTOdell Apr 3, 2024
5e474a5
More clean up. Trying to implement `infer_async`, may need some help.
BTOdell Apr 4, 2024
90bc4dc
Switch tests to use anyhow.
BTOdell Apr 4, 2024
40f523d
Revert minor test change.
BTOdell Apr 4, 2024
6e2e460
Update gitmodules to be more lightweight when using repo as a depende…
BTOdell Apr 12, 2024
74b1bab
Add more API methods for Core (still need to be implemented).
BTOdell Apr 12, 2024
e6033cc
Improve version function.
BTOdell Apr 12, 2024
9046e0b
Implement Display for DeviceType.
BTOdell Apr 12, 2024
c90c6e9
Implement core versions function.
BTOdell Apr 12, 2024
50bc141
Switch from Into to AsRef.
BTOdell Apr 12, 2024
2edc17c
Implement available_devices function.
BTOdell Apr 12, 2024
2e8dd77
Working on enabling get/set of properties.
BTOdell Apr 13, 2024
1ce1fbe
Expose RwPropertyKey.
BTOdell Apr 13, 2024
67755ac
Add common derives to PropertyKey and RwPropertyKey.
BTOdell Apr 13, 2024
00dff59
Fix variadic arguments with dynamic linking (still need to fix runtim…
BTOdell Apr 13, 2024
77b20f6
Add more CompiledModel functions.
BTOdell Apr 15, 2024
df44064
Add more Port functions.
BTOdell Apr 15, 2024
ed1d59a
Add Debug to Shape.
BTOdell Apr 15, 2024
09d9691
Revert "Add Debug to Shape."
BTOdell Apr 15, 2024
2139f84
Working on infer request callback support...
BTOdell Apr 16, 2024
6f8e243
Add more tensor methods to InferRequest.
BTOdell Apr 16, 2024
e356b63
Add Send trait to callback handle.
BTOdell Apr 16, 2024
35fcd02
Add Send trait to Tensor.
BTOdell Apr 16, 2024
c1a3b68
Pin infer request callback.
BTOdell Apr 18, 2024
c7d6347
Revert "Pin infer request callback."
BTOdell Apr 18, 2024
30bf0f1
Fix segfault issue with set_callback function in InferRequest.
BTOdell Apr 18, 2024
ecf1d0c
Remove `mut` from some InferRequest methods.
BTOdell Apr 18, 2024
893bef0
Fix Linux compile error.
BTOdell Apr 18, 2024
cab9c98
Make tensor instance pub(crate).
BTOdell Apr 18, 2024
9caa906
Fix `find_import_library` on macOS.
BTOdell Apr 29, 2024
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
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
# found ("dyld: Library not loaded; '@rpath/libopenvino.2310.dylib'"). See
# https://github.com/abrown/openvino-rs/actions/runs/6423141936/job/17441022932#step:7:154
os: [ubuntu-20.04, ubuntu-22.04, windows-latest]
version: [2022.3.0, 2023.1.0, 2023.2.0]
version: [2022.3.1, 2023.3.0, 2024.0.0]
apt: [false]
# We also spot-check that things work when installing from APT by adding to the matrix: see
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
include:
- os: ubuntu-22.04
version: 2023.2.0
version: 2023.3.0
apt: true
env:
RUST_LOG: debug
Expand Down Expand Up @@ -56,9 +56,6 @@ jobs:
# path and Cargo links the binary to it in the `build.rs` script.
- name: Check dynamic linking
run: cargo test
# TODO: the finder does not yet know how to distinguish between `*.lib` (required here) and
# `*.dll` (required by runtime-linking).
if: ${{ !startsWith(runner.os, 'windows') }}
# Finally, run the runtime-linking tests: the binddings do not link at build time, instead
# as the tests are run.
- name: Check runtime linking
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
target
4 changes: 3 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[submodule "crates/upstream"]
path = crates/openvino-sys/upstream
url = https://github.com/openvinotoolkit/openvino
depth = 1
update = none
fetchRecurseSubmodules = false
shallow = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtshallow

It's possible that depth = 1 was working as expected, but it's not a documented property in .gitmodules.

1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 38 additions & 10 deletions crates/openvino-finder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,46 @@ macro_rules! check_and_return {
///
/// Panics if it cannot list the contents of a search directory.
pub fn find(library_name: &str) -> Option<PathBuf> {
let file = format!(
let library = format!(
"{}{}{}",
env::consts::DLL_PREFIX,
library_name,
env::consts::DLL_SUFFIX
);
log::info!("Attempting to find library: {}", file);
log::info!("Attempting to find library: {}", library);
find_library(&library)
}

/// Find the path to an OpenVINO link library.
///
/// Follows the same procedure as [find], but searches for "import" libraries.
/// This differentiation is important on Windows, which requires ".lib" when linking:
/// https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-creation#creating-an-import-library
pub fn find_link(library_name: &str) -> Option<PathBuf> {
find_import_library(library_name)
}

#[cfg(not(target_os = "windows"))]
#[inline(always)]
fn find_import_library(library_name: &str) -> Option<PathBuf> {
find(library_name)
}

#[cfg(target_os = "windows")]
#[inline(always)]
fn find_import_library(library_name: &str) -> Option<PathBuf> {
let library = format!("{}.lib", library_name);
log::info!("Attempting to find link library: {}", library);
find_library(&library)
}

fn find_library(library: &str) -> Option<PathBuf> {
// Search using the `OPENVINO_BUILD_DIR` environment variable; this may be set by users of the
// `openvino-rs` library.
if let Some(build_dir) = env::var_os(ENV_OPENVINO_BUILD_DIR) {
let install_dir = PathBuf::from(build_dir);
for lib_dir in KNOWN_BUILD_SUBDIRECTORIES {
let search_path = install_dir.join(lib_dir).join(&file);
let search_path = install_dir.join(lib_dir).join(&library);
check_and_return!(search_path);
}
}
Expand All @@ -111,7 +137,7 @@ pub fn find(library_name: &str) -> Option<PathBuf> {
if let Some(install_dir) = env::var_os(ENV_OPENVINO_INSTALL_DIR) {
let install_dir = PathBuf::from(install_dir);
for lib_dir in KNOWN_INSTALLATION_SUBDIRECTORIES {
let search_path = install_dir.join(lib_dir).join(&file);
let search_path = install_dir.join(lib_dir).join(&library);
check_and_return!(search_path);
}
}
Expand All @@ -121,7 +147,7 @@ pub fn find(library_name: &str) -> Option<PathBuf> {
if let Some(install_dir) = env::var_os(ENV_INTEL_OPENVINO_DIR) {
let install_dir = PathBuf::from(install_dir);
for lib_dir in KNOWN_INSTALLATION_SUBDIRECTORIES {
let search_path = install_dir.join(lib_dir).join(&file);
let search_path = install_dir.join(lib_dir).join(&library);
check_and_return!(search_path);
}
}
Expand All @@ -130,7 +156,7 @@ pub fn find(library_name: &str) -> Option<PathBuf> {
// `DYLD_LIBRARY_PATH` on MacOS).
if let Some(path) = env::var_os(ENV_LIBRARY_PATH) {
for lib_dir in env::split_paths(&path) {
let search_path = lib_dir.join(&file);
let search_path = lib_dir.join(&library);
check_and_return!(search_path);
}
}
Expand All @@ -143,13 +169,13 @@ pub fn find(library_name: &str) -> Option<PathBuf> {
.filter(|d| d.is_dir())
{
// Check if the file is located in the installation directory.
let search_path = install_dir.join(&file);
let search_path = install_dir.join(&library);
check_and_return!(search_path);

// Otherwise, check for version terminators: e.g., `libfoo.so.3.1.2`.
let filenames = list_directory(&install_dir).expect("cannot list installation directory");
let versions = get_suffixes(filenames, &file);
if let Some(path) = build_latest_version(&install_dir, &file, versions) {
let versions = get_suffixes(filenames, &library);
if let Some(path) = build_latest_version(&install_dir, &library, versions) {
check_and_return!(path);
}
}
Expand All @@ -161,7 +187,7 @@ pub fn find(library_name: &str) -> Option<PathBuf> {
.filter(|d| d.is_dir())
{
for lib_dir in KNOWN_INSTALLATION_SUBDIRECTORIES {
let search_path = default_dir.join(lib_dir).join(&file);
let search_path = default_dir.join(lib_dir).join(&library);
check_and_return!(search_path);
}
}
Expand Down Expand Up @@ -220,12 +246,14 @@ const KNOWN_INSTALLATION_SUBDIRECTORIES: &[&str] = &[
"runtime/lib/intel64/Release",
"runtime/lib/intel64",
"runtime/3rdparty/tbb/lib",
"runtime/bin/intel64/Release",
"runtime/bin/intel64",
"runtime/3rdparty/tbb/bin",
];

const KNOWN_BUILD_SUBDIRECTORIES: &[&str] = &[
"bin/intel64/Debug/lib",
"bin/intel64/Debug",
"bin/intel64/Release/lib",
"temp/tbb/lib",
];
Expand Down
2 changes: 1 addition & 1 deletion crates/openvino-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn add_dynamically_linked_library(library: &str) {
fn find_libraries_in_existing_installation() -> Vec<PathBuf> {
let mut dirs = vec![];
for library in LIBRARIES {
if let Some(path) = openvino_finder::find(library) {
if let Some(path) = openvino_finder::find_link(library) {
println!(
"cargo:warning=Found library to link against: {}",
path.display()
Expand Down
Loading