Orientation for AI coding agents (Claude Code, Codex, Cursor) working in this repo. Humans should
read README.md; if the two ever disagree, README wins for humans and this file wins
for agents — keep them in lockstep.
tensorrt_cpp_api is a C++ library that wraps NVIDIA TensorRT for CNN-class vision models: build a
TensorRT engine from ONNX, cache it on disk, and run inference. It has optional fused GPU
preprocessing, optional OpenCV interop, and optional zero-copy Python bindings. Linux + NVIDIA
GPU only. It is not an LLM/transformer serving framework, and Windows is out of scope.
Targets TensorRT >= 10 (written to the TensorRT 11 surface, version-gated), CUDA 12, C++20.
cmake -S . -B build -DTRT_CPP_API_BUILD_TESTS=ON # add -DTensorRT_DIR=<root> for a tarball TensorRT
cmake --build build -j
ctest --test-dir build -LE gpu # CPU-only tests; drop -LE gpu to run the full suite (needs a GPU)scripts/install_deps.sh (one-time, needs sudo) and scripts/verify_deps.sh help set up a host.
If nvcc is not on PATH, pass -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc.
include/tensorrt_cpp_api/— the public headers (one umbrellaall.h). Nonvinfer1, OpenCV, or spdlog types appear here; the optionalpreproc.h/opencv_interop.hare separate.src/— implementation;src/detail/is internal (TensorRT glue, cache, buffers, execution).python/— the pybind11trtcppextension.examples/— reference programs.tests/— GoogleTest.
- Formatting:
.clang-format(LLVM-based, 4-space, 140 col) and.cmake-format.yaml. Runpre-commit run --all-files(orclang-format -i) before committing. CI enforces clang-format. - Comments: default to none; comment only the non-obvious why, never narrate code.
- No emojis anywhere — source, comments, or commit messages.
- Public API: no-throw — every fallible call returns
StatusorResult<T>(no exceptions); name-keyed tensor IO (unordered_map<string, TensorView>); caller-provided CUDA streams; no third-party types leaked through public headers (PImpl + version-gating). - Git: never force-push, never amend a pushed commit, never skip hooks.
- Usage & concepts:
docs/quickstart.md - Install options:
docs/install.md - Migrating from v6:
docs/upgrading_from_v6.md
Reference downstream consumers: YOLOv8-TensorRT-CPP
and YOLOv9-TensorRT-CPP.