Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

10: Devices

E1001

Invalid devices declaration. The device isn’t cpu, mps or cuda; cuda has no device numbers, or a number twice; or cpu or mps has numbers.

devices tpu

See Declaring devices.

E1002

Unknown devices option. An indented line under a devices declaration is an option, for running on several devices. The options are shard params and split NAME, one per line; any other line, shard without params, and split without one name are errors.

devices cuda[0 1]
    shard parameters

Write shard params or split H. See Options for several devices.

E1003

Devices declared more than once. A file has a second devices line, or a notebook cell declares devices other than the ones an earlier cell declared. A program declares its devices once; in a notebook, restart the kernel to change them.

devices cpu
devices cuda[0]

See Declaring devices.

E1004

devices after other declarations. The devices line comes before every other declaration in a file or cell. Comments and blank lines may come before it.

dim D = 64

devices cpu

See Declaring devices.

E1005

Standalone build without devices. shapescript build --standalone makes a module that doesn’t use the shapescript package, so it can’t ask which devices the program declared. The file needs a devices line, or the build needs --devices.

$ cat model.ss
fn double(x: [n]) -> [n] = x * 2
$ shapescript build --standalone model.ss -o model.py
error[E1005]: a standalone build needs to know its devices

See Building for a device.

E1006

--devices disagrees with the file’s devices. shapescript build --devices, or devices= in shapescript.compile, says different devices than the file’s devices line. Remove one of them, or make them agree.

$ cat model.ss
devices cuda[0]

fn double(x: [n]) -> [n] = x * 2
$ shapescript build --devices "cuda[1]" model.ss -o model.py
error[E1006]: the file declares `devices cuda[0]`, but `--devices` says `cuda[1]`

See Building for a device.