Selects native CPU or GPU execution for dense-vector primitives and exact batched search.
CPU execution uses Vettore's Rust SIMD kernels and remains the default. GPU
execution is provided directly by the native Rust NIF through wgpu; Nx is
not involved and remains an optional interchange format only.
GPU execution can be enabled globally:
config :vettore,
gpu: true,
gpu_fallback: :cpuOr per call with gpu: true. For forced GPU execution, gpu_fallback
controls what happens when an adapter cannot be initialized or execution
fails:
:cpu(default) transparently uses the SIMD CPU kernel;:errorreturns a stable tagged error.
gpu: :auto uses the GPU only when one is available and the operation has at
least :gpu_min_size coordinates (1,000,000 by default). For Flat search the
workload is the resident matrix shape (rows * dimensions). It always uses CPU
when no adapter is available, independently of the forced-GPU fallback policy.
This avoids paying GPU transfer and synchronization costs for small vectors.
Summary
Functions
Compatibility alias for gpu_detected?/0.
Returns true when Vettore can initialize a hardware GPU through wgpu.
Returns information about the selected hardware GPU adapter.
Returns the configured mode, fallback, threshold, and detected GPU details.
Types
Functions
@spec gpu_detected() :: boolean()
Compatibility alias for gpu_detected?/0.
@spec gpu_detected?() :: boolean()
Returns true when Vettore can initialize a hardware GPU through wgpu.
@spec gpu_info() :: {:ok, %{name: String.t(), backend: String.t(), device_type: String.t()}} | {:error, :gpu_not_available | term()}
Returns information about the selected hardware GPU adapter.
@spec info() :: map()
Returns the configured mode, fallback, threshold, and detected GPU details.