Environment Variables#

This page is intentionally scoped to the capture-and-replay shim (TRT_SHIM_*) documented in Capture and Replay.

It is not a complete index of every environment variable that appears in TensorRT workflows. Variables such as LD_LIBRARY_PATH, PATH, CUDA_VISIBLE_DEVICES, and framework-specific settings are documented where those workflows live (install method pages, samples, and tooling guides).

Use these entry points for other behavior-changing variables:

The table below lists only TRT_SHIM_* variables.

Capture-and-replay shim (TRT_SHIM_*)#

Set these variables before launching an application through the TensorRT capture shim (LD_PRELOAD or drop-in replacement). For setup instructions, refer to Capture and Replay.

Warning

The capture shim is a development and debugging tool. Do not preload it in a production process.

Captured .json and .bin output can contain proprietary model weights in cleartext. Write capture output only to a restricted, non-shared directory, and remove it when debugging is complete.

TRT_SHIM_NVINFER_LIB_NAME controls which native TensorRT library is loaded into the process. Set it only to a trusted, absolute path that is not writable by untrusted users.

Note

TRT_SHIM_OUTPUT_JSON_FILE takes precedence over TRT_SHIM_FORCE_SINGLE_THREAD_API. If both are set, the shim does not enforce single-threaded API calls.

Table 24 TRT_SHIM_* environment variables#

Variable

Description

Type

Default

TRT_SHIM_OUTPUT_JSON_FILE

Path to save the captured .json file. A corresponding .bin file is created in the same directory.

string

capture.json

TRT_SHIM_NVINFER_LIB_NAME

Intercepted TensorRT library name. If unset, dlopen(<lib_name>) finds the library using its normal search rules (a full path is also allowed).

string

libnvinfer.so

TRT_SHIM_DUMP_API

Print enter and exit messages for every API function call.

bool

false

TRT_SHIM_PRINT_WELCOME

Print Welcome to TensorRT Shim at the start of the run.

bool

false

TRT_SHIM_FORCE_SINGLE_THREAD_API

Lock every API call to enforce single-threaded execution. Ignored when TRT_SHIM_OUTPUT_JSON_FILE is set.

bool

false

TRT_SHIM_INLINE_WEIGHTS_LOWER_EQUAL_THAN

Inline weights into the .json instead of a separate .bin when their size (in elements) is ≤ this threshold.

int

8

TRT_SHIM_MARK_AS_RANDOM_WEIGHTS_GREATER_EQUAL_THAN

Skip saving weights with an element count ≥ this threshold (they will be marked as random).

int

Max int

TRT_SHIM_FLUSH_AFTER_EVERY_CALL

Flush captured calls to the file after every API call instead of aggregating them.

bool

false

TRT_SHIM_FLUSH_ON_BUILD

Flush captured calls after every buildSerializedNetwork call. Useful for debugging crashes during engine building or for capturing incremental progress in multi-network sessions.

bool

false

TRT_SHIM_SET_TACTIC_CACHE

Path to a tactic-cache file loaded into IBuilderConfig so tactic selection stays consistent across runs. Load only a cache from a trusted, integrity-verified artifact location; timing caches can contain JIT-compiled code.

string

""

See also

Capture and Replay

How to install and run the capture shim.

Troubleshooting

Common errors and debugging guidance.