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

[Tokenizers] Added LC_RPATH to additionally point to openvino's libs #784

Merged
merged 1 commit into from
Dec 13, 2023
Merged
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
28 changes: 13 additions & 15 deletions .ci/azure/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ jobs:
unzip gradle-$(GRADLE_VER)-bin.zip
# For opencv-python: python3-setuptools and pip upgrade
python3 -m pip install --upgrade pip
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/requirements.txt
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/requirements_test.txt
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# Speed up build
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
Expand Down Expand Up @@ -171,17 +170,28 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r $(REPO_DIR)/modules/custom_operations/tests/requirements.txt
python -m pip install $(INSTALL_DIR)/tools/openvino-*.whl
python -m pip install $(OPENVINO_REPO_DIR)/tools/mo/
workingDirectory: $(WORK_DIR)
displayName: 'Create virtual env'

- script: |
source $(WORK_DIR)/.env3/bin/activate
# need to enable sparse_conv tests with new Open3D release
python -m pytest -k "not sparse_conv" tests/run_tests.py
env:
CUSTOM_OP_LIB: $(BIN_DIR)/libuser_ov_extensions.so
workingDirectory: $(REPO_DIR)/modules/custom_operations
displayName: 'Custom user operation tests'

- script: |
source $(WORK_DIR)/.env3/bin/activate && source $(SETUPVARS)
python -m pip install build
python -m build --wheel --outdir $(BUILD_WHEEL_DIR) $(REPO_DIR)/modules/custom_operations
workingDirectory: $(WORK_DIR)
displayName: 'Build tokenizers wheel'

- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- script: |
source $(WORK_DIR)/.env3/bin/activate
# Find and install wheel
Expand All @@ -192,18 +202,6 @@ jobs:
workingDirectory: $(WORK_DIR)
displayName: 'Install tokenizers wheel'

- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- script: |
source $(WORK_DIR)/.env3/bin/activate
# need to enable sparse_conv tests with new Open3D release
python -m pytest -k "not sparse_conv" tests/run_tests.py
env:
CUSTOM_OP_LIB: $(BIN_DIR)/libuser_ov_extensions.so
workingDirectory: $(REPO_DIR)/modules/custom_operations
displayName: 'Custom user operation tests'

- script: |
source $(WORK_DIR)/.env3/bin/activate
python -m pytest tokenizers_test.py
Expand Down
12 changes: 7 additions & 5 deletions .ci/azure/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ jobs:
brew install scons
# Speed up build
brew install ninja
# install python wheel dependencies
python3.10 -m pip install --upgrade pip
python3.10 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
python3.10 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
workingDirectory: $(WORK_DIR)
displayName: 'Install dependencies'
Expand Down Expand Up @@ -162,7 +165,6 @@ jobs:
source venv/bin/activate && source $(SETUPVARS)
python -m pip install --upgrade pip
python -m pip install -r $(REPO_DIR)/modules/custom_operations/tests/requirements.txt
python -m pip install $(OPENVINO_REPO_DIR)/tools/mo/
# Find and install wheel
pushd $(INSTALL_DIR)/tools
wheel_name=$(find . -name 'openvino-*.whl')
Expand All @@ -178,6 +180,9 @@ jobs:
workingDirectory: $(WORK_DIR)
displayName: 'Build tokenizers wheel'
- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- script: |
source $(WORK_DIR)/venv/bin/activate
# Find and install wheel
Expand All @@ -188,9 +193,6 @@ jobs:
workingDirectory: $(WORK_DIR)
displayName: 'Install tokenizers wheel'
- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- script: |
source $(WORK_DIR)/venv/bin/activate
python -m pytest tokenizers_test.py
Expand Down
39 changes: 19 additions & 20 deletions .ci/azure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ jobs:
call $(SETUPVARS) -pyver 3.8
$(PYTHON_EXE) -m pip install --upgrade pip
$(PYTHON_EXE) -m pip install -r $(OPENVINO_REPO_DIR)\src\bindings\python\src\compatibility\openvino\requirements-dev.txt
$(PYTHON_EXE) -m pip install -r $(OPENVINO_REPO_DIR)\src\bindings\python\requirements.txt
$(PYTHON_EXE) -m pip install -r $(REPO_DIR)\modules\custom_operations\tests\requirements.txt
$(PYTHON_EXE) -m pip install $(OPENVINO_REPO_DIR)\tools\mo
$(PYTHON_EXE) -m pip install -r $(OPENVINO_REPO_DIR)\src\bindings\python\wheel\requirements-dev.txt
powershell -command "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
choco install opencv -y
workingDirectory: $(WORK_DIR)
Expand Down Expand Up @@ -167,23 +165,6 @@ jobs:
workingDirectory: $(BUILD_DIR_CONTRIB)
displayName: 'Build OpenVINO Contrib'

- script: |
call $(SETUPVARS)
$(PYTHON_EXE) -m pip install build
$(PYTHON_EXE) -m build --wheel --outdir $(BUILD_WHEEL_DIR) $(REPO_DIR)\modules\custom_operations
workingDirectory: $(WORK_DIR)
displayName: 'Build tokenizers wheel'
- powershell: |
# Find and install the wheel
$wheelPath=Get-ChildItem -Path "$(BUILD_WHEEL_DIR)" -Filter openvino_tokenizers*.whl | % { $_.FullName }
$(PYTHON_EXE) -m pip install "$wheelPath[all]"
workingDirectory: $(WORK_DIR)
displayName: 'Install tokenizers wheel'
- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- script: |
call $(SETUPVARS)
set PATH=$(WORK_DIR)\gradle-$(GRADLE_VER)-bin\gradle-$(GRADLE_VER)\bin;%PATH%
Expand All @@ -195,12 +176,30 @@ jobs:
- script: |
call C:\tools\opencv\build\setup_vars_opencv4.cmd
call $(SETUPVARS) -pyver 3.8 && ^
$(PYTHON_EXE) -m pip install -r $(REPO_DIR)\modules\custom_operations\tests\requirements.txt
$(PYTHON_EXE) -m pytest -k "not sparse_conv" tests\run_tests.py
env:
CUSTOM_OP_LIB: $(BUILD_DIR_CONTRIB)\user_ie_extensions\user_ov_extensions.dll
workingDirectory: $(REPO_DIR)\modules\custom_operations
displayName: 'Custom user operation tests'
- script: |
call $(SETUPVARS)
$(PYTHON_EXE) -m pip install build
$(PYTHON_EXE) -m build --wheel --outdir $(BUILD_WHEEL_DIR) $(REPO_DIR)\modules\custom_operations
workingDirectory: $(WORK_DIR)
displayName: 'Build tokenizers wheel'
- publish: $(BUILD_WHEEL_DIR)
artifact: Wheels

- powershell: |
# Find and install the wheel
$wheelPath=Get-ChildItem -Path "$(BUILD_WHEEL_DIR)" -Filter openvino_tokenizers*.whl | % { $_.FullName }
$(PYTHON_EXE) -m pip install "$wheelPath[all]"
workingDirectory: $(WORK_DIR)
displayName: 'Install tokenizers wheel'
- script: |
call $(SETUPVARS) -pyver 3.8 && ^
$(PYTHON_EXE) -m pytest tokenizers_test.py
Expand Down
13 changes: 11 additions & 2 deletions modules/custom_operations/user_ie_extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,18 @@ include(GNUInstallDirs)

# setting RPATH / LC_RPATH depending on platform
if(LINUX)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
# to find libcore_tokenizer.so in the same folder
set(rpaths "$ORIGIN")
elseif(APPLE)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
# to find libcore_tokenizer.dylib in the same folder
set(rpaths "@loader_path")
if(DEFINED SKBUILD)
# in case we build pip package, we need to refer to libopenvino.dylib from 'openvino' package
list(APPEND rpaths "@loader_path/../../openvino/libs")
endif()
endif()
if(rpaths)
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}")
endif()

# Installing the extension module to the root of the package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@
else:
sys.exit(f"Error: extension does not support the platform {sys.platform}")

# conda-forge case
conda_forge_lib_path = Path(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
if os.path.exists(conda_forge_lib_path / _ext_name):
_ext_path = conda_forge_lib_path / _ext_name
else:
_ext_path = _ext_libs_path / _ext_name
_ext_path = _ext_name if os.environ.get("CONDA_PREFIX") else (_ext_libs_path / _ext_name)

del _ext_name
del _ext_libs_path
del conda_forge_lib_path
del _extension_path

# patching openvino
old_core_init = openvino.runtime.Core.__init__
Expand Down
Loading