python-backend编译
手动git依赖
git clone -b v2.6 --depth 5 git@github.com:pybind/pybind11.git
git clone -b v0.5 git@github.com:dmlc/dlpack.git
git clone -b r22.10 https://github.com/triton-inference-server/backend.git
git clone -b r22.10 https://github.com/triton-inference-server/core.git
git clone -b r22.10 git@github.com:triton-inference-server/common.git
wget -r https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
mkdir github
把下载的依赖全部放进去
修改CMakeLists
修改依赖
FetchContent_Declare(
repo-common
SOURCE_DIR /workspace/python_backend/github/common
)
FetchContent_Declare(
repo-core
SOURCE_DIR /workspace/python_backend/github/core
)
FetchContent_Declare(
repo-backend
SOURCE_DIR /workspace/python_backend/github/backend
)
FetchContent_MakeAvailable(repo-common repo-core repo-backend)
ExternalProject_Add(
boostorg
URL file:///workspace/python_backend/github/boost_1_76_0.tar.gz
PREFIX "boost-src"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy_directory
<SOURCE_DIR>/boost/ ${CMAKE_BINARY_DIR}/boost
INSTALL_COMMAND ""
BUILD_COMMAND ""
)
set(boostorg_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/boost/")
外部依赖都改成类似这样
修改pybind11的CMakeLists
这一行后面加上 set(DPYTHON_EXECUTABLE=/usr/include/python3.8)
环境有什么版本什么路径就写什么
否则默认python3.9
cmake_dependent_option(PYBIND11_FINDPYTHON "Force new FindPython" OFF
"NOT CMAKE_VERSION VERSION_LESS 3.12" OFF)
set(DPYTHON_EXECUTABLE=/usr/)
执行编译
mkdir build
cd build
cmake -DTRITON_ENABLE_GPU=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.8 -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install ..
make install
替换python后端
将install/backends/python
整个文件替换掉原本的/opt/tritonserver/backends/python