This document is relevant for: Trn2, Trn3

nki.language.device_print#

nki.language.device_print(print_prefix, tensor)[source]#

Print a message with a string prefix followed by the value of a tile.

During kernel execution on hardware, the Neuron Runtime (NRT) exports device-printed tensors via the NRT debug stream API. By default, setting the environment variable NEURON_RT_DEBUG_OUTPUT_DIR to a directory path enables the default stream consumer, which dumps tensor data to that directory. The output is organized as: <output_dir>/<print_prefix>/core_<logical_core_id>/<iteration>/.

In CPU simulation, this prints immediately to stdout.

Parameters:
  • print_prefix – prefix of the print message. Evaluated at trace time; must be a constant string.

  • tensor – tensor to print out. Can be in SBUF or HBM.

This document is relevant for: Trn2, Trn3