The native accelerator¶
fastumap ships a compiled Rust extension, fastumap._accel, inside the wheel. It reimplements the
SGD layout kernel and the k-means kernel. The prebuilt wheels (abi3, Python 3.11+; Linux x86_64
and aarch64/Graviton, musllinux for Alpine, and Windows x86_64) carry it, so it is used
automatically. macOS has no prebuilt wheel yet and builds from the sdist, which requires a Rust
toolchain, as does any other platform without a prebuilt wheel.
The numpy path remains as a runtime fallback. If the extension is absent, for instance in an unbuilt source checkout, fastumap still works, more slowly. The SGD kernel is roughly 1.7 to 1.9× faster, with slightly higher overlap.
Because the kernel performs umap-learn's in-place walk rather than the fallback's per-epoch approximation, it produces a different, higher-quality layout for the same seed. The active path can be queried:
import fastumap
fastumap.accelerator_active() # True if the native kernel is present (the normal case)
Upgrading from fastumap-accel: that package no longer exists separately. Its kernels are built
into fastumap itself from 0.2.1 onward. Run pip install -U fastumap and drop any
fastumap-accel dependency; nothing else changes.
Building it yourself¶
Run from the repository root — maturin reads the root pyproject.toml (its [tool.maturin]
points manifest-path at this rust/Cargo.toml) and builds the whole fastumap wheel, Python
plus extension:
maturin develop --release # build + install into the active virtualenv (development)
maturin build --release # wheel for the current platform
maturin sdist # source distribution
# maturin build --release --zig --target aarch64-unknown-linux-gnu # aarch64 / Graviton
MIT licensed, as fastumap.
Next¶
- What the kernel changes about determinism: Guarantees.
- Measured k-means numbers: Benchmark reports.