Skip to main content

Aidge logo

EPL 2.0 Examples PyPi Examples Documentation Status GitLab Contributors Open GitLab Issues Closed GitLab Issues

Aidge Export: TensorRT

The aim of this module is to provide an export to TensorRT SDK via the Aidge framework.

Quick start

System Requirements

  • python >= 3.10
  • aidge_core
pip install aidge-export-cpp

To compile the export, you need one of the following:

  • Docker installed (recommended). The Docker image includes TensorRT, so no additional installation is required.
  • TensorRT 8.6 or 10.10 installed on your host machine (required only if compiling directly on the host without Docker).

🛠 Build from Source

Prerequisite (in addition to previous one):

1. Python installation using setup scripts

Environment Python Development
Windows .\setup.ps1 -Modules export_cpp -Tests
Unix ./setup.sh -m export_cpp --tests

2. Python Installation using pip

Run these commands from the aidge_export_cpp/ directory:

#fStandard install
pip install . -v

# Install with testing dependencies
pip install .[test] -v && pytest

Editable Install (Experimental)

Use this for real-time development without re-installing.

pip install --no-build-isolation -ve . --config-settings=editable.rebuild=true -Cbuild-dir=build

Usage

aidge_export_tensorrt module exposes its main python API using export() function.

import aidge_export_tensorrt
aidge_export_tensorrt.export("export_trt", "model.onnx")

The export provides a Makefile with several options to utilize the export on your machine. You can generate either a C++ export or a Python export.
Additionally, you have the option to compile the export and/or the Python library using Docker if your host machine lacks the necessary packages.

The available commands are summarized in the following table:

Command Description
make / make help Display the different options available
make build_cpp Compile the export on host for C++ apps (generate an executable in build/bin)
make build_lib_python Compile the export on host for Python apps (generate a python lib in build/lib)
make build_image_docker Generate the docker image of the tensorrt compiler
make build_cpp_docker Compile the export in a container for C++ apps (generate an executable in build/bin)
make test_cpp_docker Test the executable for C++ apps in a container
make build_lib_python_docker Compile the export in a container for Python apps (generate a python lib in build/lib)
make test_lib_python_docker Test the lib for Python apps in a container
make clean Clean up the build and bin folders

Here's an example to compile and test the export Python library using Docker:

cd export_trt/ 
make build_lib_python_docker
make test_lib_python_docker

This will execute the test.py file within the Docker container, initializing and profiling the selected model.

Known issue

Export side

Issue related to the usage of the TensorRT export.

No CMAKE_CUDA_COMPILER could be found

CMake Error at CMakeLists.txt:21 (enable_language):
  No CMAKE_CUDA_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.

This error occur when you try to compile your project without having NVCC to your PATH.

To fix this, add nvcc to the path:

export PATH=<NVCC_PATH>:$PATH;

Where <NVCC_PATH> is the path to the nvcc compiler. For recent ORIN nvcc is installed at: /usr/local/cuda/bin.

Metadata

Release files for aidge-export-tensorrt 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for aidge-export-tensorrt 0.10.1
File Interpreter ABI Platform
aidge_export_tensorrt-0.10.1-py3-none-any.whl Python 3 none any Details

Release files / aidge_export_tensorrt-0.10.1-py3-none-any.whl

Download URL aidge_export_tensorrt-0.10.1-py3-none-any.whl
Size 93.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6175d51a340027dadb2d963d2948b8598a7930205da78c0cf550b13f0c7e12ee
BLAKE2b-256 checksum
How to use checksums
ecb48df9a7fad47299ce310e3a28cc813e70fa9e254f1fca1a82508aef359e69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.10.1 This release

1 release file

0.10.0

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.2.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page