JavaScript · Residency

Residency

import * as usearch from 'usearch'; 3.0.0-rc.1 · 4c3e5023

An executor and an index are each built through the residency they drive, so a direct new usearch.Executor() or new usearch.DenseIndex() throws and names the factories instead. An index runs its verbs only on an executor of its own residency, and arena.describe() reports where an arena’s outputs live as { residency, device }, with device null for host pages.

const hostIndex = usearch.DenseIndex.initRam({ dimensions: 128 }, [0, 1]);
const deviceIndex = usearch.DenseIndex.initVram({ dimensions: 128 }, [0, 1]);
const diskIndex = usearch.DenseIndex.viewNvme('index.safegraphs.json', { executor: diskPool, paths: ['/mnt/nvme0', '/mnt/nvme1'] });

initRam shards over the named NUMA nodes, absent spreading the shards over every node, and initVram over the named CUDA ordinals, absent taking one free device. An NVMe index is never initialized, only served in place from a checkpoint, read-only. An index’s free() waits for every deferred call naming it, and a freed index refuses every later call.

API

Types

ResidencyWhere an executor computes, and so where the arenas it makes keep their memory.
usearch.ts:85 ↗
enum Residency

Values

Ram"ram"Host memory traversed by CPU threads.
Vram"vram"Accelerator memory traversed by GPU streams, which no host view reads.
Nvme"nvme"Persisted memory read through submission rings; its arenas are host pages.