Quickstart
This page assumes that csl-pp and the Cerebras SDK are on your PATH, as described in Installation.
Compile a vanilla CSL program
Section titled “Compile a vanilla CSL program”csl-pp takes the same arguments as cslc, and every CSL program is a csl++ program. Copy the first GEMV tutorial of the SDK and compile it with csl-pp in place of cslc:
cp -r ~/cerebras-sdk/csl-extras-*/examples/tutorials/gemv-01-complete-program .cd gemv-01-complete-programcsl-pp --arch=wse3 ./layout.csl --fabric-dims=8,3 --fabric-offsets=4,1 \ -o out --memcpy --channels 1cs_python run.py --name outcsl-pp writes the CSL it generates to a temporary directory and runs cslc on it. out/ contains the output of cslc, and run.py runs on the simulator as with cslc. cs_python is in the SDK directory.
Compile a csl++ program
Section titled “Compile a csl++ program”The example programs of this documentation are in the csl++ repository. Clone it and run the first program of the tutorial:
git clone https://github.com/esa-tu-darmstadt/csl-pp.gitcd csl-pp/website/examples/tutorial/1-suspend./commands_wse3.shThe script compiles the program with csl-pp and runs its host program on the simulator:
#!/usr/bin/env bash
set -e
csl-pp ./src/layout.csl --arch=wse3 --fabric-dims=10,3 --fabric-offsets=4,1 \ -o out --memcpy --channels=1cs_python ./run.py --name outThe program consists of three PEs in a row. The middle PE receives a value from each of its two neighbors and adds them, and the host program prints the result:
1.5 + 2.25 = 3.75SUCCESS!The middle PE does this in one task, which suspends while it waits for a value:
async task sum_task() void { // Receive the value of the west neighbor into the local variable west. var west: f32 = 0.0; const west_dsd = @get_dsd(mem1d_dsd, .{ .base_address = &west, .extent = 1 }); @fmovs(west_dsd, west_in_dsd, .{ .async = true, .activate = @current_task() }); suspend;
// The same for the east neighbor. var east: f32 = 0.0; const east_dsd = @get_dsd(mem1d_dsd, .{ .base_address = &east, .extent = 1 }); @fmovs(east_dsd, east_in_dsd, .{ .async = true, .activate = @current_task() }); suspend;
x[0] = west + east; sys_mod.unblock_cmd_stream();}The Tutorial explains this program and develops it further. csl-pp describes the options of csl-pp and the files it writes.