Environment Variables#

This page lists TensorRT-related environment variables referenced in the documentation. Today these variables configure the capture-and-replay shim used by Capture and Replay.

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.

Table 19 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.

string

""

See also

Capture and Replay

How to install and run the capture shim.

Troubleshooting

Common errors and debugging guidance.