This document is relevant for: Inf2, Trn1, Trn2, Trn3
Reference: Neuron Runtime environment variables#
The Neuron Runtime (libnrt.so) reads its configuration from process-level environment variables that control NeuronCore allocation, collectives, memory, execution, logging, profiling, and debugging. Neuron framework extensions set most of these on your behalf, so set them explicitly only when you need a specific behavior. Use this page to look up a variable, its type and default, and when to apply it. It lists every runtime variable that is supported for customer use; variables not listed here are internal diagnostics and are unsupported.
Applies to#
The Neuron Runtime (
libnrt.so) on AWS Trainium and Inferentia instances.
How to use these environment variables#
Set a variable inline for a single process, or export it to apply it to every process in the shell session:
# Apply to one invocation only
NEURON_RT_VISIBLE_CORES=0-3 python myapp.py
# Apply to every process in this shell
export NEURON_RT_LOG_LEVEL=INFO
export NEURON_RT_LOG_LOCATION=console
python myapp.py
Boolean variables accept 0, 1, false, or true,
case-insensitively.
To partition one instance across several processes, give each process its own
slice of cores with NEURON_RT_VISIBLE_CORES:
# Partition one instance across parallel processes
NEURON_RT_VISIBLE_CORES=0-1 python worker.py &
NEURON_RT_VISIBLE_CORES=2-3 python worker.py &
By default the runtime logs at WARN to both console and syslog; setting only
NEURON_RT_LOG_LEVEL sends logs to the console alone and stops syslog output,
and setting only NEURON_RT_LOG_LOCATION lowers the level to ERROR, so
warnings are no longer logged.
Functional#
These variables control normal runtime behavior — which cores a process uses, how models load, distributed bootstrap, and numerics. Set them to make the runtime do something specific that the framework does not configure for you.
Variable |
Type / default |
Subsystem |
Description |
|---|---|---|---|
|
Range list ( |
Core allocation & topology |
Restrict the process to an explicit set of logical NeuronCores, so multiple processes can partition one instance. Validated against actually-visible |
|
Unsigned integer; default: |
Core allocation & topology |
Set the LNC size: how many physical NeuronCores fuse into one logical core. Must be a power of two dividing the per-device core count; only |
|
Host-and-port string; default: unset |
Networking & barriers |
Socket address ( |
|
Unsigned integer seconds; default: |
DMA & execution |
Per-execution timeout in seconds. Distributed workloads may legitimately need far more than the default because of network interruptions — the usual cause of spurious timeouts. |
|
Unsigned integer; default: |
Model loading & firmware |
Accept older NEFF format versions that would otherwise be rejected. When unset, NRT uses |
|
Boolean; default: |
Model loading & firmware |
Verify the NEFF package hash at load, catching a corrupt or tampered artifact before execution. When unset, NRT uses |
|
Boolean; default: |
Collectives |
Pre-validate replica groups before |
|
Unsigned integer; default: |
Networking & barriers |
Bootstrap port for the async send/recv feature above. When unset, NRT uses |
|
Boolean; default: |
Networking & barriers |
Enable the experimental asynchronous EFA send/recv path. When unset, NRT uses |
|
Boolean; default: driver-dependent |
Networking & barriers |
Selects the driver P2P interface instead of dma-buf for EFA memory registration. NRT defaults to P2P when dma-buf v2 is unavailable and forces P2P back on if the user disables it with an incompatible driver. |
|
Boolean; default: |
Numerics |
Stop treating |
|
Boolean; default: |
Numerics |
Enable stochastic rounding across DMA — reduces systematic bias when accumulating in low precision. When unset, NRT uses |
|
Unsigned integer; default: |
Numerics |
Seed the stochastic rounding RNG, making an otherwise nondeterministic run reproducible. When unset, NRT uses |
Warning
NEURON_RT_ALLOW_LEGACY_NEFF is for testing only and should not be used in
production. Running a NEFF compiled for a different target architecture can
cause silent data corruption in model outputs or hangs at runtime, among
other unexpected failures.
Performance tuning#
These variables trade off throughput, latency, and memory. The defaults are tuned for common cases; reach for these when profiling shows a specific bottleneck in collectives, scratchpad memory, or the networking proxy path.
Variable |
Type / default |
Subsystem |
Description |
|---|---|---|---|
|
Byte count; default: |
DMA & execution |
Global DMA packetisation size. Hard-capped at |
|
Unsigned integer; default: |
DMA & execution |
In-flight request depth for the hardware execution queue. Capped at 63 by the 4 MB host DMA allocation limit; higher values warn and clamp rather than fail. |
|
Boolean; default: |
Model loading & firmware |
Skips construction of the model debug-information graph during NEFF load. This can reduce load work, but source-level out-of-bounds diagnostics will not be available for that model. |
|
Unsigned integer; default: |
Collectives |
Number of collectives channel buffers. Does not affect the P2P path ( |
|
Byte count; default: |
Collectives |
Collectives chunk size. Does not affect the P2P path. |
|
|
Collectives |
Divide TOP_SPs and DMA qbundles between streams as |
|
Unsigned integer list; default: unset |
Collectives |
Per-stream max DMA packet size for collectives (list starting at stream 0). Kept for backward compatibility only: the runtime’s per-priority packet sizing takes precedence, and when that is in effect this variable is ignored with a warning. |
|
Boolean; default: |
Networking & barriers |
Drop the collectives barrier between executions. Valid only when the workload is genuinely SPMD and the caller runs its own barrier (typical distributed inference) — a real latency win, and a hang if the precondition doesn’t hold. |
|
Boolean; default: arch-dependent |
Networking & barriers |
Use the hardware execution barrier. Defaults on for Trn2-family and Neuron Switch v1; left off on Trn1 due to a suspected deadlock with the barrier’s traffic pattern. |
|
Integer range list; default: unset |
Networking & barriers |
Confine latency-sensitive runtime threads to a chosen CPU set (e.g. |
|
Boolean; default: |
Networking & barriers |
Pin each proxy thread to a single CPU core and drop |
|
Unsigned integer; default: |
Networking & barriers |
Consolidate N ranks onto one network proxy thread, trading proxy parallelism for CPU cores. Requires the HW barrier: init fails if |
|
Boolean; default: |
Networking & barriers |
Register one EFA memory region covering all HBM instead of one per tensor — far fewer registrations at scale. Requires |
|
Boolean; default: driver-dependent |
Memory & scratchpad |
Allocates scratchpad pages adjacent in HBM and defaults on where the platform and driver support it. Set it to |
|
Boolean; default: |
Memory & scratchpad |
mmap HBM into the process address space during device init (Trn2+ only), enabling direct host access. Prerequisite for |
|
Unsigned integer MiB; default: |
Memory & scratchpad |
Scratchpad page size in MiB. Ignored when contiguous scratchpad is in use, because that path forces 64 MiB pages. When a model’s largest variable does not fit the current page size, the runtime logs a recommended value for this variable alongside the matching compiler flag. |
Observability#
These variables control what the runtime logs and which metrics and diagnostic events it emits. Use them to increase visibility during bring-up, performance analysis, or a support investigation. Profile capture has its own section, Profiling, and core dumps are under Debugging.
Variable |
Type / default |
Subsystem |
Description |
|---|---|---|---|
|
Byte count; default: |
Model loading & firmware |
Size the per-Pool-engine stdout queue, enabling |
|
String enum; default: |
Numerics |
Choose how loudly NaN/Inf and other numerical error notifications are reported: |
|
Boolean; default: |
Logging & diagnostics |
Break the device-memory usage log into every allocation category instead of just aggregates — the tool for “who ate my HBM”. When unset, NRT uses |
|
Byte count; default: |
Logging & diagnostics |
Size the in-memory ring log retained for post-mortem dumps. When unset, NRT uses |
|
Boolean; default: |
Logging & diagnostics |
Emit a verbose device-memory report when an allocation OOMs. When unset, NRT uses |
|
Boolean; default: |
Logging & diagnostics |
Emit a metric on every device-memory alloc and free. When unset, NRT uses |
|
String enum; default: |
Logging & diagnostics |
Set the global log verbosity ( |
|
String enum; default: console and syslog |
Logging & diagnostics |
Send logs to |
|
Log-level enum; default: inherits global |
Logging |
Set verbosity for one submodule without changing the others. Valid submodules: |
|
Log-destination enum; default: inherits global |
Logging |
Send one submodule’s logs to |
|
Unsigned integer seconds; default: |
Logging & diagnostics |
Minimum seconds between repeated NC memory-error reports, to keep a flapping cell from flooding logs. When unset, NRT uses |
|
Filesystem path string; default: |
Failure forensics |
Destination for device-memory OOM dumps. Path capped at 200 chars; over-long paths log an error and fall back to the default. |
|
Unsigned integer count; default: |
Profiling & tracing |
Size the |
Note
NEURON_RT_NUMERICAL_ERRORS_VERBOSITY and NEURON_FAIL_ON_NAN are
subject to a hardware limitation: once a numerical condition is flagged on an
engine, the hardware status can stay set, so the same error may be reported
again for later operations that did not actually produce it. Treat the
reports at any verbosity level as a signal that a numerical condition
occurred somewhere in execution, not as exact per-operation attribution, and
expect possible false positives after the first genuine occurrence.
Restarting the application clears the sticky state.
Profiling#
These variables control the runtime’s own capture of device profiles and system
traces, and the size of the on-device buffers that hold the captured records.
NEURON_RT_INSPECT_ENABLE is the master switch; the other
NEURON_RT_INSPECT_* variables select what is captured and where it is
written, and the NEURON_RT_PROFILE_BUF_* variables size each category of
notification buffer. Raise a buffer only when a capture reports truncated
notifications for that category — the memory comes out of the device.
Variable |
Type / default |
Description |
|---|---|---|
|
Boolean; default: |
Master switch for profile capture — captures one profile per unique NEFF execution. The single variable that turns profiling on. |
|
Boolean; default: |
Add host CPU-utilisation sampling to the profile. When unset, NRT uses |
|
String enum; default: disabled |
Enable on-device hardware profile capture: |
|
Unsigned integer; default: |
Discard the first N executions before profiling, so cold-start artifacts stay out of the data. Only valid in |
|
Integer range list; default: all visible |
Restrict system-trace capture to specific logical cores, cutting profile size on a 64-core box. Errors if you name a core that is not visible. |
|
Comma-separated token list; default: all events |
Filters which event types are traced. It accepts categories ( |
|
Boolean; default: |
Add host memory-usage sampling to the profile. When unset, NRT uses |
|
Boolean; default: |
Capture a device profile only when an execution fails — zero steady-state overhead, evidence on the failing run. Implies |
|
Filesystem path string; default: cwd |
Destination directory for captured profile artifacts. When unset, NRT uses cwd. |
|
Boolean; default: |
Pre-cache profile metadata on warmup executions so the profiled iterations carry less overhead — improves profile fidelity. When unset, NRT uses |
|
Boolean; default: |
Enable/disable host-side system profile (API and runtime event timeline). When unset, NRT uses |
|
Unsigned integer count; default: |
Bound system-trace events retained per core. When unset, NRT uses |
|
Unsigned integer MiB; default: |
Sets the collectives-core event notification buffer used by device profiling. Increase it when collectives event records are truncated. |
|
Unsigned integer MiB; default: |
Sets the collectives-core instruction notification buffer used by device profiling. Increase it when collectives instruction records are truncated. |
|
Unsigned integer MiB per DMA engine; default: |
Sets the device-profile DMA notification buffer for each DMA engine, so its total HBM cost scales with the number of engines. Increase it when DMA records are truncated and reduce it when profile memory use is too high. |
|
Unsigned integer MiB; default: |
Sets the device-profile notification buffer for event records. Increase it when event notifications are truncated, while accounting for the additional device-memory use. |
|
Unsigned integer MiB; default: |
Sets the notification buffer for top-level host-to-device and device-to-host DMA profiling; |
|
Unsigned integer MiB; default: |
Sets the device-profile notification buffer for instruction trace records. A value of |
|
Unsigned integer MiB; default: |
Sets the device-profile notification buffer for throttle records. Increase it when throttle notifications are truncated, while accounting for the additional device-memory use. |
|
Boolean; default: |
Enable notifications from dynamic DMA (DGE) rings. When unset, NRT uses |
Note
These are the complete set of runtime profiling controls. For the end-to-end profiling workflow that uses them, see the Neuron Profiler documentation.
Debugging#
These variables capture extra evidence — input tensors, a device core dump, or a known fill pattern in device memory — to reproduce and diagnose a failure. They add overhead or change behavior, so enable them only for a targeted investigation and remove them afterward.
Variable |
Type / default |
Subsystem |
Description |
|---|---|---|---|
|
Signed integer; default: |
Failure forensics |
Persist all input tensors when execution fails, so a failure is reproducible offline. |
|
Filesystem path string; default: |
Failure forensics |
Destination for the above input dumps. When unset, NRT uses |
|
Filesystem path string; default: |
Failure forensics |
Local destination for runtime core dumps. Supports |
|
S3 URI string; default: unset |
Failure forensics |
S3 prefix handed to |
|
Enum or 32-bit unsigned integer; default: |
Memory & scratchpad |
Scrub HBM at init with a chosen pattern so stale data can’t masquerade as real output. Accepts |
Deprecated#
These names are obsolete. Remove them from your environment, launch scripts, and configuration files, and use the replacement instead. The Status column says what the runtime does with each one today: a name that is still applied keeps working for now but may stop being honored in a future release, while a name that is parsed but ignored already has no effect on how the runtime runs.
Variable |
Status |
Subsystem |
Description |
|---|---|---|---|
|
Deprecated; still applied |
Core allocation & topology |
Requests N cores without specifying which, leaving the choice to the runtime. Not topology-aware, so it cannot express a placement that works for collectives. Still parsed and still applied: use |
|
Deprecated; still applied |
Core allocation & topology |
Older spelling of |
|
Parsed but ignored |
DMA & execution |
This legacy variable used to enable implicit asynchronous execution, a mode that has been removed. Positive values produce a migration warning and are ignored; use the explicit NRT async APIs. |
Learn more#
Neuron Runtime How-To Guides — all Neuron Runtime how-to guides.
How to migrate from implicit async mode to explicit async APIs — move off the deprecated implicit async variable and onto the
nrta_*APIs.Neuron Profiler documentation — the full set of profiling controls.
This document is relevant for: Inf2, Trn1, Trn2, Trn3