Skip to main content

init_backends

Function init_backends 

Source
pub fn init_backends(dir: impl AsRef<Path>) -> Result<()>
Expand description

Load backend modules from dir (dynamic builds) and register their devices. A no-op in static builds. Call once, before the first model load.

Errors with crate::Error::Backend if, after loading, the process has no registered compute device (a dynamic build pointed at a directory with no usable modules). This call is idempotent per directory and NOT retryable in the same process.

This mutates the native process-global device registry. Complete every backend-init call before other threads enumerate devices, query backend availability, or load models; the native registry does not support racing registration against those operations.