Build from source#

The packages relies on cmake to build the C++ extensions. whether it wrapped with pybind11 or cython. Both options are available and can be linked with openmp, eigen, onnxruntime, CUDA. cmake is called from setup.py with two instructions:

  • python setup.py build_ext --inplace, the legacy way

  • pip install -e ., the new way

By default, cmake builds with CUDA if it is available. It can be disabled:

  • python setup.py build_ext -v --inplace --with-cuda=0, the legacy way

  • pip install -e . -v --config-settings="--with-cuda=0", the new way (not fully working yet)

  • pip install -e . -v --global-option "--with-cuda=0", the deprecated way

  • USE_CUDA=0 pip install -e . -v, the run around way

In case there are multiple versions of CUDA installed, option cuda-version can be specified:

python setup.py build_ext --inplace --cuda-version=11.8

The development versions of onnxruntime can be used if it was already build --ort-version=<version or build path>. Example:

python setup.py build_ext --inplace --cuda-version=11.8 --ort-version=/home/github/onnxruntime/build/linux_cuda/Release