Python · Introspection

Introspection

import usearchfrom usearch import DenseIndexDescription, DenseReachability 3.0.0-rc.1 · 4c3e5023

index.count(42)  # entries sharing this key
42 in index  # the same question, as a membership test
len(index)  # stored entries
index.describe()  # a DenseIndexDescription: .metadata, .size, .capacity, .memory_usage, .cpu_class, .gpu_class, .shards_count
index.health()  # a DenseReachability: .audited, .reachable, .sweeps
index.cpu_class  # the CPU class dispatch picked on this machine
usearch.capabilities_compiled()  # the kernel families this build carries
usearch.capabilities_available()  # the ones this machine can run

capacity, dimensions, connectivity and memory_usage are properties read through describe as well. health audits how much of the graph a search reaches, and the entries it cannot reach wait for a refine to re-link them. Every docstring names the C symbol it calls, or says the method is Python-only.

API

Types

CPUClassThe CPU families dispatch picks from; a placement may pin one.
__init__.py:237 ↗
class CPUClass(IntEnum)

Values

SERIAL1The portable floor: no SIMD assumptions.
INTEL_HASWELL2Haswell-class x86: AVX2 and FMA, the 256-bit floor.
INTEL_SIERRA3Sierra Forest-class x86, the E-core Xeons: AVX-VNNI without AVX-512.
INTEL_SKYLAKE4Skylake-class x86: the AVX-512 foundation tier.
INTEL_ICELAKE5Icelake-class x86: AVX-512 VNNI and VPOPCNT.
AMD_GENOA6Genoa-class x86, Zen 4 and newer: native bf16 dot products over AVX-512.
INTEL_SAPPHIRE7Sapphire Rapids-class x86: the Genoa bundle plus AVX-512 FP16 and AMX tiles.
INTEL_GRANITE8Granite Rapids-class x86: the Sapphire Rapids bundle plus AMX-FP16 tiles.
INTEL_DIAMOND9Diamond Rapids-class x86: the Granite Rapids bundle plus AVX10.2 FP8 conversions.
AWS_G210Graviton2-class Arm, Neoverse N1: the bare NEON floor.
APPLE_M211Armv8.6 NEON with dot products and bf16 and f16 fused multiplies, as in Apple M2.
APPLE_M412Apple M4-class Arm: the Armv8.6 NEON bundle plus SME outer-product tiles.
AWS_G513Graviton5-class Arm, Neoverse V3 and Armv9.2: monitored waits.
NVIDIA_VERA14Vera-class Arm: NVIDIA's Armv9.2-generation cores with FP8 dot products.
ALIBABA_C93015Alibaba C930-class RISC-V, RVA23: vectors with Zvbb, monitored waits.
WASM32_V12816WebAssembly every engine loads: 32-bit, single-threaded, simd128.
WASM64_EXTENDED17WebAssembly with relaxed SIMD, shared memory and 64-bit addressing.
MONOVERSIONED18The one class of a monoversioned build, carrying every capability its floor implies.
GPUClassThe GPU families dispatch picks from; a placement may pin one.
__init__.py:277 ↗
class GPUClass(IntEnum)

Values

NVIDIA_AMPERE1Ampere-class NVIDIA and every NVIDIA GPU without a class of its own: A100, A10, RTX 30.
NVIDIA_ADA2Ada-class NVIDIA: L4, L40S and RTX 40, with fp8 conversions.
NVIDIA_HOPPER3Hopper-class NVIDIA: H100 and H200, with DPX instructions.
NVIDIA_BLACKWELL4Blackwell-class NVIDIA: B200, B300 and GB300, with TMA gather4 fetches.
NVIDIA_BLACKWELLRTX5Consumer Blackwell NVIDIA: RTX 50, RTX PRO 6000 and DGX Spark.
NVIDIA_RUBIN6Rubin-class NVIDIA, the Vera-Rubin platform's device half.
AMD_CDNA37CDNA3 AMD: MI300X and MI325X, 64-wide waves, FNUZ fp8.
AMD_CDNA48CDNA4 AMD: MI350X and MI355X, OCP fp8.
AMD_CDNA59CDNA5 AMD: MI400, 32-wide waves.
APPLE_METAL710Apple7-family GPUs and every Apple GPU without a class of its own: M1 and M2.
APPLE_METAL911Apple9-family GPUs: M3 and M4.
APPLE_METAL1012Apple10-family GPUs: M5, with Neural Accelerator matrix units.
NVMeClassThe I/O engines NVMe executors submit through; an executor may pin one.
__init__.py:305 ↗
class NVMeClass(IntEnum)

Values

POSIX1Blocking reads on the calling thread.
LINUX_AIO2Linux AIO with direct I/O.
LINUX_URING3io_uring reads on files and block devices.
LINUX_URING_PASSTHROUGH4io_uring NVMe passthrough on namespace character devices, such as "/dev/ng0n1".
LINUX_SPDK5The SPDK user-space driver, over namespaces named by transport identifiers.
WINDOWS_IORING6I/O Rings, on Windows 11 22H2 and newer.
ClassDenseIndexDescriptionA live index's frozen metadata and current counters.7
lib.pyi:1692 ↗
class DenseIndexDescription(structseq[Any], tuple[DenseMetadata, int, int, int, CPUClass | None, GPUClass | None, int])
metadataThe frozen DenseMetadata, as a checkpoint reports it.
lib.pyi:1707 ↗
metadata: DenseMetadata
sizeStored entries.
lib.pyi:1712 ↗
size: int
capacityEntries hosted without growing again.
lib.pyi:1717 ↗
capacity: int
memory_usageBytes the handle holds; traversal scratch is the executor's.
lib.pyi:1722 ↗
memory_usage: int
cpu_classThe CPUClass dispatch picked on this machine, or None.
lib.pyi:1727 ↗
cpu_class: CPUClass | None
gpu_classThe GPUClass dispatch picked on the index's devices, or None for a host index.
lib.pyi:1732 ↗
gpu_class: GPUClass | None
shards_countLive shards.
lib.pyi:1737 ↗
shards_count: int
ClassDenseReachabilityOne reachability audit.4
lib.pyi:1741 ↗
class DenseReachability(structseq[Any], tuple[int, int, int, int])
auditedEntries published when the audit started, the population it judged.
lib.pyi:1748 ↗
audited: int
reachableOf those, the entries a search reaches; the rest wait for a refine to re-link them.
lib.pyi:1753 ↗
reachable: int
sweepsLevels the sweep took to converge.
lib.pyi:1758 ↗
sweeps: int
back_sweepsLevels the sweep back toward the entry point took, where an audit sweeps both ways.
lib.pyi:1763 ↗
back_sweeps: int

Functions

versionThe library's semantic version.
__init__.py:79 ↗
def version() -> str
capabilities_compiledThe kernel families this build carries.
__init__.py:83 ↗
def capabilities_compiled() -> str
capabilities_availableThe kernel families this machine can run.
__init__.py:87 ↗
def capabilities_available() -> str
layoutsThe size and field offsets of every argument struct the other bindings lay out by hand.
__init__.py:91 ↗
def layouts() -> dict[str, tuple[int, dict[str, int]]]