mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
Cherry-pick the fix to build rel-1.15 python package for AzureEP (#16044)
Cherry-pick the fix to build python package for AzureEP. Co-authored-by: Randy Shuai <rashuai@microsoft.com>
This commit is contained in:
parent
ade58cf789
commit
ae2395cb56
5 changed files with 18 additions and 24 deletions
6
cmake/external/triton.cmake
vendored
6
cmake/external/triton.cmake
vendored
|
|
@ -75,7 +75,9 @@ else()
|
|||
PREFIX rapidjson
|
||||
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/rapidjson-src
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/rapidjson-build
|
||||
CMAKE_ARGS -DRAPIDJSON_BUILD_TESTS=OFF -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF)
|
||||
CMAKE_ARGS -DRAPIDJSON_BUILD_TESTS=OFF -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF
|
||||
INSTALL_COMMAND ""
|
||||
UPDATE_COMMAND "")
|
||||
|
||||
ExternalProject_Get_Property(rapidjson source_dir)
|
||||
set(RAPIDJSON_INCLUDE_DIR ${source_dir}/include)
|
||||
|
|
@ -91,8 +93,6 @@ else()
|
|||
INSTALL_COMMAND ""
|
||||
UPDATE_COMMAND "")
|
||||
|
||||
add_dependencies(triton rapidjson)
|
||||
|
||||
endif() #if (WIN32)
|
||||
|
||||
ExternalProject_Get_Property(triton SOURCE_DIR)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ if (onnxruntime_USE_AZURE)
|
|||
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(onnxruntime_framework PRIVATE httpclient_static curl OpenSSL::Crypto OpenSSL::SSL)
|
||||
target_link_libraries(onnxruntime_framework PRIVATE httpclient_static curl ZLIB::ZLIB OpenSSL::Crypto OpenSSL::SSL)
|
||||
|
||||
endif() #if (WIN32)
|
||||
|
||||
|
|
|
|||
18
setup.py
18
setup.py
|
|
@ -176,21 +176,6 @@ try:
|
|||
f.write(" import os\n")
|
||||
f.write(' os.environ["ORT_TENSORRT_UNAVAILABLE"] = "1"\n')
|
||||
|
||||
def _rewrite_ld_preload_azure(self):
|
||||
with open("onnxruntime/capi/_ld_preload.py", "a") as f:
|
||||
f.write("import os\n")
|
||||
f.write("from ctypes import CDLL, RTLD_GLOBAL, util\n")
|
||||
f.write("def LoadLib(lib_name):\n")
|
||||
f.write(" lib_path = util.find_library(lib_name)\n")
|
||||
f.write(" if lib_path: _ = CDLL(lib_path, mode=RTLD_GLOBAL)\n")
|
||||
f.write(" else: _ = CDLL(lib_name, mode=RTLD_GLOBAL)\n")
|
||||
f.write('for lib_name in ["RE2", "ZLIB1"]:\n')
|
||||
f.write(" try:\n")
|
||||
f.write(" LoadLib(lib_name)\n")
|
||||
f.write(" except OSError:\n")
|
||||
f.write(' print("Could not load ort azure-ep dependency: " + lib_name)\n')
|
||||
f.write(' os.environ["ORT_" + lib_name + "_UNAVAILABLE"] = "1"\n')
|
||||
|
||||
def run(self):
|
||||
if is_manylinux:
|
||||
source = "onnxruntime/capi/onnxruntime_pybind11_state.so"
|
||||
|
|
@ -315,8 +300,7 @@ try:
|
|||
self._rewrite_ld_preload(to_preload_cann)
|
||||
|
||||
else:
|
||||
if package_name == "onnxruntime-azure":
|
||||
self._rewrite_ld_preload_azure()
|
||||
pass
|
||||
|
||||
_bdist_wheel.run(self)
|
||||
if is_manylinux and not disable_auditwheel_repair and not is_openvino:
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ elif [ "$BUILD_DEVICE" == "AZURE" ]; then
|
|||
# for ubuntu
|
||||
apt-get install -y libipc-system-simple-perl python3 libssl-dev
|
||||
else
|
||||
# for redhat
|
||||
yum install -y perl-IPC-Cmd python3 openssl-devel
|
||||
export PATH=/opt/python/cp38-cp38/bin:$PATH
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,15 @@ set -e
|
|||
os_major_version=$(cat /etc/redhat-release | tr -dc '0-9.'|cut -d \. -f1)
|
||||
|
||||
echo "installing for os major version : $os_major_version"
|
||||
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel
|
||||
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel perl-IPC-Cmd openssl-devel wget
|
||||
# export PATH=/opt/python/cp38-cp38/bin:$PATH
|
||||
|
||||
echo "installing rapidjson for AzureEP"
|
||||
wget https://github.com/Tencent/rapidjson/archive/refs/tags/v1.1.0.tar.gz
|
||||
tar zxvf v1.1.0.tar.gz
|
||||
cd rapidjson-1.1.0
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --install .
|
||||
cd ../..
|
||||
Loading…
Reference in a new issue