Skip to main content

Device

__init__

__init____init__(self, spec: str) -> None

init(self, spec: str) -> None

A device from its string form (the parse() grammar). Strings also convert implicitly, so device="cpu" works wherever a Device is taken.

cpu

cpu(*args, **kwargs)

cpu(index: int = -1) -> clika_runtime._core.Device

The whole-machine CPU by default; a non-negative index names one socket.

gpu

gpu(*args, **kwargs)

gpu(index: int = 0) -> clika_runtime._core.Device

The generic accelerator (resolved at call time; falls back to cpu() when no GPU backend is available).

parse

parse(*args, **kwargs)

parse(spec: str) -> clika_runtime._core.Device

Parse "" or ":" (cpu/gpu/cuda/vulkan/metal/htp/tpu); raises RuntimeError on an unknown form.