Build details for TensorRT execution provider. (#632)

* Fixed typos in docs for 'onnx_test_runner'

* TensorRT Execution Provider (preview) release

Updated build instructions and component governence and third party notices for TensorRT execution provider release.

* test runner option for tensorrt

updated to add option for tensorrt.

* Introduction to TensorRT Execution Provider

Intro README for TensorRT Execution Provider.

* Update BUILD.md

* Update TensorRT-ExecutionProvicer.md

* corrected typo in the filename

* corrected typos

* updated with corrections.

* removed conflicting edits.

* Update BUILD.md
This commit is contained in:
manashgoswami 2019-03-15 11:29:00 -07:00 committed by jywu-msft
parent a362c3bbdf
commit bdc2bbb207
5 changed files with 78 additions and 11 deletions

View file

@ -112,6 +112,24 @@ If you want to build with an earlier version, you must temporarily remove the 'C
### MKL-DNN
To build ONNX Runtime with MKL-DNN support, build it with `./build.sh --use_mkldnn --use_mklml`
### Tensor RT
ONNX Runtime supports the Tensort RT execution provider (released as preview). You will need to download and install [CUDA](https://developer.nvidia.com/cuda-toolkit), [CUDNN](https://developer.nvidia.com/cudnn) and [TensorRT](https://developer.nvidia.com/nvidia-tensorrt-download).
The TensorRT execution provider for ONNX Runtime is built and tested with CUDA 9.0/CUDA 10.0, CUDNN 7.1 and TensorRT 5.0.2.6.
- The path to the CUDA installation must be provided via the CUDA_PATH environment variable, or the `--cuda_home parameter`. The CUDA path should contain `bin`, `include` and `lib` directories.
- The path to the CUDA `bin` directory must be added to the PATH environment variable so that `nvcc` is found.
- The path to the CUDNN installation (path to folder that contains libcudnn.so) must be provided via the CUDNN_PATH environment variable, or `--cudnn_home parameter`.
- The path to TensorRT installation must be provided via the `--tensorrt_home parameter`.
You can build from source on Linux by using the following `cmd` from the onnxruntime directory:
```
./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> (Linux)
```
### OpenBLAS
#### Windows
Instructions how to build OpenBLAS for windows can be found here https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio#build-openblas-for-universal-windows-platform.
@ -204,4 +222,4 @@ By doing this, you could avoid hit the ACR-Tasks build timeout (8 hours)
2. Use `build.bat` and specify `--arm` or `--arm64` as the build option to start building. Preferably use `Developer Command Prompt for VS` or make sure all the installed cross-compilers are findable from the command prompt being used to build using the PATH environmant variable.
### Using other compilers
(TODO)
(TODO)

View file

@ -0,0 +1,24 @@
## TensortRT Execution Provider (preview)
The TensorRT execution provider in the ONNX Runtime will make use of NVIDIA's [TensortRT](https://developer.nvidia.com/tensorrt) Deep Learning inferencing engine to accelerate ONNX model in their family of GPUs. Microsoft and NVIDIA worked closely to integrate the TensorRT execution provider with ONNX Runtime.
This execution provider release is currently in preview but, we have validated support for all the ONNX Models in the model zoo. With the TensorRT execution provider, the ONNX Runtime delivers better inferencing performance on the same hardware compared to generic GPU acceleration.
### Build TensorRT execution provider
Developers can now tap into the power of TensorRT through ONNX Runtime to accelerate inferencing of ONNX models. Instructions to build the TensorRT execution provider from source is available [here](https://github.com/Microsoft/onnxruntime/blob/master/BUILD.md#build).
### Using the TensorRT execution provider
#### C/C++
The TensortRT execution provider needs to be registered with ONNX Runtime to enable in the inference session.
```
InferenceSession session_object{so};
session_object.RegisterExecutionProvider(std::make_unique<::onnxruntime::TensorrtExecutionProvider>());
status = session_object.Load(model_file_name);
```
The C API details are [here](https://github.com/Microsoft/onnxruntime/blob/master/docs/C_API.md#c-api).
### Python
When using the python wheel from the ONNX Runtime build with TensorRT execution provider, it will be automatically prioritized over the default GPU or CPU execution providers. There is no need to separately register the execution provider. Python APIs details are [here](https://github.com/Microsoft/onnxruntime/blob/master/docs/python/api_summary.rst#api-summary).
### Using onnxruntime_perf_test
You can test the performance for your ONNX Model with the TensorRT execution provider. Use the flag `-e tensorrt` in [onnxruntime_perf_test](https://github.com/Microsoft/onnxruntime/tree/master/onnxruntime/test/perftest#onnxruntime-performance-test).

View file

@ -2786,3 +2786,28 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
_____
onnx/onnx-tensorrt
MIT License
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
Copyright (c) 2018 Open Neural Network Exchange
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -24,8 +24,8 @@ e.g.
Download the files from: https://github.com/onnx/models. Unzip them.
(TODO: put a full copy on Azure blob, instead of downloading these files from different sources individually)
# Compile onnxruntime_test_runner and run the tests
onnxruntime_test_runner is a C++ program. Its source code is in onnxruntime/test/onnx directory.
# Compile onnx_test_runner and run the tests
onnx_test_runner is a C++ program. Its source code is in onnxruntime/test/onnx directory.
Usage: onnx_test_runner [options...] <data_root>
Options:
@ -35,7 +35,7 @@ Options:
-r [repeat]: Specifies the number of times to repeat
-v: verbose
-n [test_case_name]: Specifies a single test case to run.
-e [EXECUTION_PROVIDER]: EXECUTION_PROVIDER could be 'cpu', 'cuda' or 'mkldnn'. Default: 'cpu'.
-e [EXECUTION_PROVIDER]: EXECUTION_PROVIDER could be 'cpu', 'cuda', 'mkldnn' or 'tensorrt'. Default: 'cpu'.
-x: Use parallel executor, default (without -x): sequential executor.
-h: help

View file

@ -1,4 +1,4 @@
onnxruntime_test_runner [options...] <data_root>
onnx_test_runner [options...] <data_root>
Options:
-j [models]: Specifies the number of models to run simultaneously.
-c [runs]: Specifies the number of Session::Run() to invoke simultaneously for each model.
@ -27,10 +27,10 @@ How to run node tests:
backend-test-tools generate-data -o C:\testdata
backend-test-tools is a tool under C:\Python35\Scripts (If your python was installed to C:\Python35)
3. compile onnxruntime_test_runner and run
onnxruntime_test_runner <test_data_dir>
3. compile onnx_test_runner and run
onnx_test_runner <test_data_dir>
e.g.
onnxruntime_test_runner C:\testdata\node
onnx_test_runner C:\testdata\node
How to run model tests:
@ -42,7 +42,7 @@ How to run model tests:
You may change C:\testdata to any directory in your disk.
Full document: https://www.1eswiki.com/wiki/VSTS_Drop
2. compile onnxruntime_test_runner and run
onnxruntime_test_runner <test_data_dir>
2. compile onnx_test_runner and run
onnx_test_runner <test_data_dir>
e.g.
onnxruntime_test_runner C:\testdata
onnx_test_runner C:\testdata