Rust bindings to onnxruntime
Go to file
2020-08-23 15:33:23 +01:00
.github Build with release 1.4.0 in CI 2020-08-23 15:00:41 +01:00
cbits Expect the C headers in a different location 2020-07-05 23:16:07 +02:00
examples Move run to bin so that the nix derivation builds it 2020-05-31 22:27:15 +01:00
nix niv update 2020-07-05 23:41:48 +02:00
src Fix some cargo clippy hints 2020-07-05 23:50:39 +02:00
testdata Add testdata to repo 2020-05-31 09:13:59 +01:00
.gitignore Setup cargo actions 2020-07-05 17:32:38 +02:00
build.rs Fix some cargo clippy hints 2020-07-05 23:50:39 +02:00
Cargo.lock Run the model multiple times and on multiple threads in run example 2020-05-31 20:23:00 +01:00
Cargo.toml Move run to bin so that the nix derivation builds it 2020-05-31 22:27:15 +01:00
default.nix Expect the C headers in a different location 2020-07-05 23:16:07 +02:00
LICENSE Add MIT license 2020-05-31 09:58:02 +01:00
README.md Update README 2020-08-23 15:33:23 +01:00

onnxruntime

Cargo CI Nix CI

This crate provides bindings to onnxruntime. Raw bindings to the C API (sys module) as well as some opinionated wrappers to make onnxruntime usable safely from plain Rust.

In order to build and use this crate with cargo you must either have onnxruntime installed on your system or point to the release (or build) of onnxruntime you want to use manually.

Tested (on Linux) with onnxruntime versions:

Download the latest release of onnxruntime

Download from: https://github.com/microsoft/onnxruntime/releases

Then either install it globally (for example /usr/local/{lib,include/) or export the following environment variables:

ONNXRUNTIME_LIB_DIR: path to the lib directory of the release ONNXRUNTIME_INCLUDE_DIR: path to the include directory of the release

Also make sure the lib directory is also part of LD_LIBRARY_PATH.

Build onnxruntime from source

Follow the guide at: https://github.com/microsoft/onnxruntime/blob/master/BUILD.md

For Linux/Mac OS X:

  • The lib directory will be: onnxruntime/build/Linux/RelWithDebInfo/
  • The include directory will be: onnxruntime/include/onnxruntime/core/session/

In onnxruntime directory:

./build.sh --config RelWithDebInfo --build_shared_lib --parallel
export ONNXRUNTIME_LIB_DIR=$PWD/build/Linux/RelWithDebInfo/
export ONNXRUNTIME_INCLUDE_DIR=$PWD/include
export LD_LIBRARY_PATH=$ONNXRUNTIME_LIB_DIR:$LD_LIBRARY_PATH

License

MIT License

Copyright 2020 Basile Henry, Chris Chalmers