The classes and enums documented on this page live in
cerebras.sdk.runtime.sdkruntimepybind. The canonical import block for an
SdkLayout-based host program is:
from cerebras.sdk.runtime.sdkruntimepybind import ( SdkLayout, SdkTarget, Color, Route, Edge, RoutingPosition,)
For host programs that mix SdkLayout with SdkRuntime (the typical case),
import SdkRuntime and SdkCompileArtifacts from the same module:
from cerebras.sdk.runtime.sdkruntimepybind import ( SdkRuntime, SdkCompileArtifacts,)
Given a color, an orientation (i.e., edge), a set of output routes, a size, and an
optional prefix, create and return a new input communication port. The optional prefix
can be used to create unique ports with the same color. Ports must be unique, otherwise an
exception is thrown.
Given a color, an orientation (i.e., edge), a set of input routes, a size, and an
optional prefix, create and return a new output communication port. The optional prefix
can be used to create unique ports with the same color. Ports must be unique, otherwise an
exception is thrown.
Given a symbol name symbol and data with a given 2D shape specified by width
and height, store data uniformly across the PEs of this code region. The 2D shape of
data must be a multiple of the code region’s dimensions or an error will be emitted.
class cerebras.sdk.runtime.sdkruntimepybind.Color(name: str, value: Optional[int] = None)
Bases: object
Represents a color with an optional user-specified physical value. Objects of this class can be
used for routing and can also be used to set microcode parameter values. If a physical value is
not provided, then a physical value will be allocated automatically by the compiler.
class cerebras.sdk.runtime.sdkruntimepybind.SdkLayout(platform: SdkExecutionPlatform, **kwargs)
Bases: object
Specifies a program layout. This API allows the user to define rectangular code regions, define
color routing and switching, automatically allocate colors, and automatically route between code
regions.
Constructor variant that takes a path to a fabric JSON file which is used to define the
compile target and execution platform. Takes same kwargs as above.
Sets up an input stream from the host to a 1-PE region at io_loc and then to input port
port. If io_loc is not provided, an available location will be automatically picked.
io_buffer_size can be provided to specify the buffer size at io_loc. Returns the name
of the stream’s port which can be used by the SdkRuntime direct link API method
SdkRuntime.send().
Sets up an input stream from the host to loc on a given color color assuming that
a code region is already defined at loc to consume the incoming data. An optional
prefix can be provided to uniquely identify the stream in case of naming conflicts. Returns
the name of the stream’s port which can be used by the SdkRuntime direct link API
method SdkRuntime.send().
Sets up an output stream from output port port to a 1-PE region at io_loc and then
to the host. If io_loc is not provided, an available location will be automatically
picked. io_buffer_size can be provided to specify the buffer size at io_loc. Returns
the name of the stream’s port which can be used by the SdkRuntime direct link API
methods SdkRuntime.receive() and SdkRuntime.receive_tofile().
Sets up an output stream to the host from loc on a given color color assuming that
a code region is already defined at loc to produce the outgoing data. An optional
prefix can be provided to uniquely identify the stream in case of naming conflicts. Returns
the name of the stream’s port which can be used by the SdkRuntime direct link API
methods SdkRuntime.receive() and SdkRuntime.receive_tofile().