Skip to main content
The current and future versions of the SDK match the ML software versioning scheme:
  • Cerebras ML Software 2.10 supports SDK 2.10, the current version of SDK software.
  • Cerebras ML Software 2.5 supports SDK 1.4. See the SDK 1.4 documentation.
  • Cerebras ML Software 2.4 supports SDK 1.3. See the SDK 1.3 documentation.
In addition to the containerized Singularity build of the Cerebras SDK (see Install the Cerebras SDK), Cerebras Wafer-Scale Clusters (WSC) running in appliance mode also support the SDK. This page documents some modifications needed to your code to run on a Wafer-Scale Cluster. For more information, see the Wafer-Scale Cluster setup and installation documentation.

Wafer-Scale Cluster Overview

The Cerebras Wafer-Scale Cluster is our solution to training massive neural networks with near-linear scaling. The Wafer-Scale Cluster consists of one or more CS systems, together with special CPU nodes, memory servers, and interconnects, presented to the end user as a single system, or appliance. The appliance is responsible for job scheduling and allocation of the systems. There are two types of SDK jobs that can run on the appliance: compile jobs, which compile code on a worker node, and run jobs, which either run the compiled code on a worker node using the simulator, or run the code on a real CS system within the appliance. This guide walks through some changes necessary to compile and run your code on a Wafer-Scale Cluster. To request modified code examples for a Wafer-Scale Cluster, contact developer@cerebras.net. Unlike ML jobs, SDK jobs on a Wafer-Scale Cluster currently have a limitation: they can only use a single worker node and CS system. See SDK Appliance API Reference for the full API documentation.

Set Up the Environment

First, learn about the components of the Cerebras Wafer-Scale Cluster. You interact with the Wafer-Scale Cluster via a user node. Start by setting up a Python virtual environment on the user node:
Next, install the cerebras_appliance and cerebras_sdk Python wheels in the virtual environment, specifying the proper Cerebras Software release:

Compile

As an example, this guide walks through porting the Complete Program tutorial. In the containerized SDK setup, this code is compiled with the following command:
To compile for the Wafer-Scale Cluster, use a Python script which launches a compile job:
The SdkCompiler::compile function takes four arguments:
  • the directory containing the CSL code files,
  • the name of the top level CSL code file that contains the layout block,
  • the compiler arguments,
  • and the output directory or output file for the compile artifacts.
The last argument can either be a directory, specifying the location to which compile artifacts will be copied with default file name; or a file name, explicitly specifying the name and location for the compile artifacts. The function returns the compile artifact path. This artifact path is written to a JSON file, which is read by the runner object in the Python host code. Just as before, simply pass the full dimensions of the target system to the --fabric-dims argument to compile for a real hardware run. The SdkCompiler() constructor can take a few optional kwargs, including:
  • resource_cpu: number of CPU cores on the WSC’s management node used by the compile job in units of 1/1000 CPU (default: 24000, or 24 cores)
  • resource_mem: number of bytes of memory requested from the management node for the compile job (default: 64 << 30, or 64 GiB)
  • disable_version_check: specifies whether to ignore version differences between appliance client and server
If SDK compilation jobs on the WSC are often waiting in the queue behind other jobs, such as ML execute or run jobs, this is typically because not enough resources are available on the management node. These kwargs can be used to request fewer resources from the management node and increase the number of simultaneously running jobs.

Run with SdkLauncher

In the containerized SDK setup, the Python host code for running is as follows:
If this file is named run.py and the compilation output is in the directory out, run it with the command:
To run on hardware, specify an IP address with the --cmaddr flag. The SDK provides an SdkLauncher class for running host code directly from a worker node within the appliance. This class allows files to be staged on the appliance before running the same host code that you would with the Singularity container. The following example demonstrates using SdkLauncher to run the host code for the example above, including a demonstration of stage for transferring a file to the appliance. To pass a system address to a run script when using SdkLauncher, you must use the %CMADDR% template string, as demonstrated below.

Run with SdkRuntime Bindings

The SdkRuntime appliance bindings are deprecated. Use SdkLauncher to wrap an SDK host Python script instead.
For appliance mode, some modifications can also be made to the original run.py script to run it on the appliance:
In particular:
  • The imports have changed to reflect appliance modules.
  • You read the path of the compile artifacts from the JSON file generated when compiling.
  • You no longer need to specify a CM address when running on real hardware. Instead, you simply pass a flag to the SdkRuntime constructor specifying whether to run in the simulator or on hardware.
  • load() and run() are replaced by start().
  • You must use a context manager for the runner object. Doing so makes the start() and stop() functions implicit, so you don’t need to explicitly call them.

Control Appliance Logging

When running with the appliance, you can control the level of appliance-related logging printed to the console. By default, the appliance logger uses the WARNING level, so only WARNING and higher level messages appear. You can set the level of the logger directly to enable other levels, such as INFO or DEBUG. For example:

Monitor and Manage Appliance Jobs

Monitor jobs on the cluster with the csctl CLI tool. Find more information on cluster job monitoring and csctl in the Cerebras training docs. Use Ctrl-C to cancel a running job.