Closed5

onnxruntimeをビルドする

fate_shelledfate_shelled

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
fate_shelledfate_shelled

ビルド後の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
fate_shelledfate_shelled

Wheelパッケージはonnxruntime/build/Linux/RelWithDebInfo/dist/に生成される。

fate_shelledfate_shelled

インストール。

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にクローズされました