This document is relevant for: Trn1, Trn2, Trn3

nki.simulate#

nki.simulate(kernel)[source]#

Create a CPU-simulated version of an NKI kernel.

Warning

This API is experimental and may change in future releases.

See nki.simulate for full documentation including target platform selection, precise floating-point mode, debugging, and known limitations.

Example:

@nki.jit
def my_kernel(a, b): ...

# Explicit simulation
result = nki.simulate(my_kernel)(a_np, b_np)

# With LNC2
result = nki.simulate(my_kernel[2])(a_np, b_np)
Parameters:

kernel – NKI kernel function, typically decorated with @nki.jit. If a plain function is passed, it is automatically wrapped.

Returns:

A callable that, when invoked with NumPy arrays, executes the kernel on CPU and returns NumPy array results.

This document is relevant for: Trn1, Trn2, Trn3