Closed5
onnxruntimeをビルドする
Clone
git clone --recursive https://github.com/microsoft/onnxruntime
with CUDA, TensorRT, OpenVINO
CUDA, TensorRT, OpenVINOはインストール済みとします。
--cudnn_home
, --cuda_home
: CUDA, TensorRTを有効化するのに必要
CPU_FP32
: OpenVINOのデフォルトExecutionProvider
--config RelWithDebInfo
: CMAKE_BUILD_TYPEにRelWithDebInfo(デバッグ情報付きのリリース・ビルド)を指定。他にRelease
とかDebug
とかを指定可能っぽい。
--build_shared_lib
: 共有ライブラリも生成する
--parallel
: 並列ビルド
--build_wheel
: Python用のWheelパッケージをビルドする
cd onnxruntime
./build.sh \
--cudnn_home /usr/lib/x86_64-linux-gnu/ --cuda_home /usr/local/cuda \
--use_cuda \
--use_tensorrt --tensorrt_home /usr/src/tensorrt \
--use_openvino CPU_FP32 \
--config RelWithDebInfo \
--build_shared_lib \
--parallel \
--build_wheel
ビルド後のTestでこけて進めないのでテストをスキップします。
./build.sh \
--cudnn_home /usr/lib/x86_64-linux-gnu/ --cuda_home /usr/local/cuda \
--use_cuda \
--use_tensorrt --tensorrt_home /usr/src/tensorrt \
--use_openvino CPU_FP32 \
--config RelWithDebInfo \
--build_shared_lib \
--parallel \
--build_wheel \
--skip_tests
Wheelパッケージはonnxruntime/build/Linux/RelWithDebInfo/dist/
に生成される。
インストール。
cd build/Linux/RelWithDebInfo
sudo make install
pybind11でfatal: unsafe repository
。
gitリポジトリの所有者が異なるとかいうエラー。エラーメッセージに出ているようにsafe.direcotry
に追加する。sudo
つけないとダメでした。
sudo git config --global --add safe.directory {onnxruntime_dir}/build/Linux/RelWithDebInfo/pybind11/src/pybind11
改めてインストール
sudo make install
このスクラップは2022/04/15にクローズされました