Search code examples
c++onnxonnxruntime

Setting up ONNX Runtime on Ubuntu 20.04 (C++ API)


I am currently in the midst of trying to get my image processing programs to work on Ubuntu (coming from windows).

I have successfully built and linked the OpenCV and Boost libraries to work with my cpp programs but I have yet to find any instructions as to setting up Onnx Runtime C++ on Ubuntu 20.04 other than using the following command with NuGet Package manager for a specific Visual Studio Project:

Install-Package Microsoft.ML.OnnxRuntime -Version 1.4.0

When on Windows, I would only need use the NuGet package manager to download the library for the given visual studio project. It seems possible to do this on Ubuntu using NuGet, but I was wondering if I could do it more "manually" like the boost and OpenCV building and installing. Thanks!


Solution

  • For the default CPU version, you can download the tgz file here.

    For other flavors of ONNX runtime that are not available as tgz or NuGet (e.g. TensorRT), you can build them locally:

    ./build.sh --cudnn_home <path to cuDNN e.g. /usr/lib/x86_64-linux-gnu/> --cuda_home <path to folder for CUDA e.g. /usr/local/cuda> --use_tensorrt --tensorrt_home <path to TensorRT home>
    

    More instructions can be found at Building ONNX Runtime