Swift · Introspection

Introspection

import USearch 3.0.0-rc.1 · 4c3e5023

let description = try index.describe()
print(description.metadata.dimensions, description.metadata.connectivity)
print(description.size, description.capacity, description.memoryUsage, description.cpuClass, description.shardsCount)
print(try index.count(key: 42), try index.contains(key: 42))

let reachability = try index.on(executor).health()
print(reachability.reachable, "of", reachability.audited, "entries reachable after", reachability.sweeps, "sweeps")

print(version(), capabilitiesCompiled(), capabilitiesAvailable())

health audits how much of the graph a search reaches from its landmarks; entries it misses stay unfound until a refine re-links them.

API

StructCPUClassA CPU family USearch ships tuned variants for; dispatch reports its pick in this vocabulary, and a RAM or NVMe placement or executor may pin one.20
Types.swift:778 ↗
struct CPUClass

Conforms to

Hashable, Sendable, CustomStringConvertible, Equatable
serialThe portable floor, with no SIMD assumptions.
Types.swift:783 ↗
static let serial: CPUClass
intelHaswellHaswell-class x86: AVX2 and FMA.
Types.swift:785 ↗
static let intelHaswell: CPUClass
intelSierraSierra Forest-class x86: AVX-VNNI without AVX-512.
Types.swift:787 ↗
static let intelSierra: CPUClass
intelSkylakeSkylake-class x86: the AVX-512 foundation.
Types.swift:789 ↗
static let intelSkylake: CPUClass
intelIcelakeIcelake-class x86: AVX-512 VNNI and VPOPCNT.
Types.swift:791 ↗
static let intelIcelake: CPUClass
amdGenoaGenoa-class x86: native bf16 dot products over AVX-512.
Types.swift:793 ↗
static let amdGenoa: CPUClass
intelSapphireSapphire Rapids-class x86: AVX-512 FP16 and the AMX tiles.
Types.swift:795 ↗
static let intelSapphire: CPUClass
intelGraniteGranite Rapids-class x86: the AMX-FP16 tiles.
Types.swift:797 ↗
static let intelGranite: CPUClass
intelDiamondDiamond Rapids-class x86: AVX10.2's FP8 conversions.
Types.swift:799 ↗
static let intelDiamond: CPUClass
awsG2Graviton2-class Arm: the bare NEON floor.
Types.swift:801 ↗
static let awsG2: CPUClass
appleM2Armv8.6 NEON with dot products and bf16.
Types.swift:803 ↗
static let appleM2: CPUClass
appleM4Apple M4-class Arm: the SME outer-product tiles.
Types.swift:805 ↗
static let appleM4: CPUClass
awsG5Graviton5-class Arm: Armv9.2.
Types.swift:807 ↗
static let awsG5: CPUClass
nvidiaVeraVera-class Arm: FP8 dot products.
Types.swift:809 ↗
static let nvidiaVera: CPUClass
alibabaC930Alibaba C930-class RISC-V: RVA23 vectors.
Types.swift:811 ↗
static let alibabaC930: CPUClass
wasm32V128WebAssembly with fixed-width simd128.
Types.swift:813 ↗
static let wasm32V128: CPUClass
wasm64ExtendedWebAssembly with relaxed SIMD, threads and 64-bit addressing.
Types.swift:815 ↗
static let wasm64Extended: CPUClass
monoversionedThe one class of a monoversioned build.
Types.swift:817 ↗
static let monoversioned: CPUClass
descriptionThe class as the library spells it.
Types.swift:820 ↗
var description: String { get }
initReads a spelling back, and nil for one no class carries.
Types.swift:823 ↗
init?(name: String)
StructGPUClassA GPU family USearch ships tuned variants for; a VRAM placement or executor may pin one.14
Types.swift:834 ↗
struct GPUClass

Conforms to

Hashable, Sendable, CustomStringConvertible, Equatable
nvidiaAmpereAmpere-class NVIDIA, and every NVIDIA GPU without a class of its own.
Types.swift:839 ↗
static let nvidiaAmpere: GPUClass
nvidiaAdaAda-class NVIDIA: the fp8 conversions.
Types.swift:841 ↗
static let nvidiaAda: GPUClass
nvidiaHopperHopper-class NVIDIA.
Types.swift:843 ↗
static let nvidiaHopper: GPUClass
nvidiaBlackwellBlackwell-class NVIDIA.
Types.swift:845 ↗
static let nvidiaBlackwell: GPUClass
nvidiaBlackwellRTXConsumer Blackwell NVIDIA.
Types.swift:847 ↗
static let nvidiaBlackwellRTX: GPUClass
nvidiaRubinRubin-class NVIDIA.
Types.swift:849 ↗
static let nvidiaRubin: GPUClass
amdCDNA3CDNA3 AMD: gfx942.
Types.swift:851 ↗
static let amdCDNA3: GPUClass
amdCDNA4CDNA4 AMD: gfx950.
Types.swift:853 ↗
static let amdCDNA4: GPUClass
amdCDNA5CDNA5 AMD: gfx1250.
Types.swift:855 ↗
static let amdCDNA5: GPUClass
appleMetal7Apple7-family GPUs, and every Apple GPU without a class of its own.
Types.swift:857 ↗
static let appleMetal7: GPUClass
appleMetal9Apple9-family GPUs.
Types.swift:859 ↗
static let appleMetal9: GPUClass
appleMetal10Apple10-family GPUs.
Types.swift:861 ↗
static let appleMetal10: GPUClass
descriptionThe class as the library spells it.
Types.swift:864 ↗
var description: String { get }
initReads a spelling back, and nil for one no class carries.
Types.swift:867 ↗
init?(name: String)
StructDenseIndexDescriptionA live index's frozen metadata and current counters, each read once, so under concurrent insertions they may come from slightly different moments.7
DenseIndex.swift:122 ↗
struct DenseIndexDescription

Conforms to

Sendable
metadataThe frozen metric, quantization, dimensions and connectivity, as a checkpoint reports them.
DenseIndex.swift:124 ↗
var metadata: DenseMetadata
sizeThe stored entries.
DenseIndex.swift:126 ↗
var size: Int
capacityThe entries hosted without growing again.
DenseIndex.swift:128 ↗
var capacity: Int
memoryUsageThe bytes the handle holds; traversal scratch is the executor's.
DenseIndex.swift:130 ↗
var memoryUsage: Int
cpuClassThe CPU class whose kits the index dispatched to on RAM and NVMe; nil on VRAM.
DenseIndex.swift:132 ↗
var cpuClass: CPUClass?
gpuClassThe GPU class whose kernels the index dispatched to on VRAM; nil on RAM and NVMe.
DenseIndex.swift:134 ↗
var gpuClass: GPUClass?
shardsCountThe live shards, each a graph of its own.
DenseIndex.swift:136 ↗
var shardsCount: Int
StructDenseReachabilityOne reachability audit: the population it judged, and how much of it a search reaches.4
DenseIndex.swift:150 ↗
struct DenseReachability

Conforms to

Equatable, Sendable
auditedThe entries published when the audit started; compare reachable against this, never a later size.
DenseIndex.swift:153 ↗
var audited: Int
reachableOf those, the entries a search reaches from the landmarks; the rest no search finds until a refinement re-links them.
DenseIndex.swift:156 ↗
var reachable: Int
sweepsThe levels the sweep took to converge.
DenseIndex.swift:158 ↗
var sweeps: Int
backSweepsThe levels the sweep back toward the entry point took, where an audit sweeps both ways.
DenseIndex.swift:160 ↗
var backSweeps: Int

Functions

versionThe version of the linked library, like 3.0.0.
Types.swift:1198 ↗
func version() -> String
capabilitiesCompiledThe hardware capabilities the linked binary was compiled with, comma separated.
Types.swift:1201 ↗
func capabilitiesCompiled() -> String
capabilitiesAvailableThe hardware capabilities the current machine offers at runtime, comma separated.
Types.swift:1204 ↗
func capabilitiesAvailable() -> String