Troubleshooting
Program hangs
Section titled “Program hangs”A suspended task continues only when it is activated. If a program hangs, check these points:
- The operation before each
suspendactivates@current_task()when it completes:.activate = @current_task(), not.unblock, and not another task. - The operation completes at all. The data it waits for is sent, and the data it sends is received.
- The async task calls
sys_mod.unblock_cmd_stream()at its end, if the host waits for the launched function withnonblock=False. - A program that uses
@await_parallelor claims task IDs at runtime claims its colors as well. On WSE-2, a color occupies the task ID with the same number, and a color that the program takes with@get_colorcan be given to a worker task; see Fixed numbers.
To see where a PE stopped, run the program on the simulator and look at the end of its trace with simtracer. simtrace out show --tile x.y --cycles A: prints the last instructions of the PE with the function they belong to, and simtrace out find --tile x.y --func NAME tells whether a function was entered at all.
PE halts
Section titled “PE halts”A runtime claim that finds no free resource halts the PE. This includes the worker tasks of @await_parallel, which are claimed at runtime. csl-pp warns at compile time if it cannot prove that enough local task IDs are free for the workers. Bind or claim fewer tasks, run fewer calls of @await_parallel at the same time, or check @count_free(local_task_id) before @await_parallel.
Task resumes too early
Section titled “Task resumes too early”A suspended task continues on any activation of its task ID. If other code activates the same ID, the task resumes before its operation has completed. Give the other code a task ID of its own.
In a trace, such a resume shows as an entry of the runtime’s entry function followed by a jump into the suspended function, before the operation has completed. simtrace out wavelets --tile x.y shows the wavelets that arrived around that cycle.
Messages of csl-pp
Section titled “Messages of csl-pp”| Message | What to do |
|---|---|
async task 't' is bound to a task, but the program never calls @coro_runtime_init() |
Call @coro_runtime_init() before the first async task is activated. |
cannot prove that enough local tasks are free for the workers of @await_parallel |
See PE halts. |
the stack sizes of the async tasks in N PE program(s) are measured by compiling them with cslc, which --no-cslc skips |
Compile without --no-cslc, or declare stack_size(N); see Stack sizes. |
csl-pp needs '.../lib/libinject_mllvm.so' to measure the stack sizes |
The library is part of the csl-pp package; reinstall the package. For a build from source, install with cmake --install, which places the library next to csl-pp. |
cannot read the Cerebras SDK image '...' |
Pass the *.sif file of the SDK with --system-module-sif. |
system imports (e.g. <memcpy/memcpy>) require --system-module-sif or --system-import-path |
Put the SDK directory on your PATH, or pass --system-module-sif. |
The pages of the Language section list the messages about async code, stacks and resources.
Generated CSL
Section titled “Generated CSL”--work-dir=<dir> keeps the CSL that csl-pp generates in <dir>; see Output files. The generated code is vanilla CSL. Comptime code is evaluated, so parameters appear as constants, and claims appear as @get_color(n), @get_local_task_id(n) and so on.