Posts ONNX runtime install
Post
Cancel

ONNX runtime install

ONNX runtime install

1. Install essential packages required for ONNX runtime installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
sudo apt update && sudo apt upgrade -y && sudo apt install -y --no-install-recommends \
    build-essential \
    software-properties-common \
    autoconf \
    automake \
    libtool \
    pkg-config \
    ca-certificates \
    wget \
    git \
    curl \
    libjpeg-dev \
    libpng-dev \
    language-pack-en \
    locales \
    locales-all \
    python3 \
    python3-py \
    python3-dev \
    python3-pip \
    python3-numpy \
    python3-pytest \
    python3-setuptools \
    libprotobuf-dev \
    protobuf-compiler \
    zlib1g-dev \
    swig \
    vim \
    gdb \
    valgrind \
    libsm6 \
    libxext6 \
    libxrender-dev \
    cmake \
    unzip

2. Install and Build ONNX runtime

  • Install python lib dependency
    1
    2
    
    pip install pytest==6.2.1
    pip install onnx==1.10.1
    
  • Build ONNX runtime

onnxruntime_build.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
ONNXRUNTIME_VERSION=1.8.2
NUM_JOBS=16

git clone --recursive --branch v${ONNXRUNTIME_VERSION} https://github.com/Microsoft/onnxruntime.git
cd onnxruntime
./build.sh \
    --cuda_home /usr/local/cuda \
    --cudnn_home /usr/lib/x86_64-linux-gnu/ \
    --use_cuda \
    # --use_tensorrt \
    # --tensorrt_home /usr/lib/x86_64-linux-gnu/ \
    --config RelWithDebInfo \
    --build_shared_lib \
    --build_wheel \
    --skip_tests \
    --parallel ${NUM_JOBS}

cd build/Linux/RelWithDebInfo
make install
pip install dist/*
This post is licensed under CC BY 4.0 by the author.