R API reference
library(autozyme)
The functions you call to use AutoZyme’s accelerators in your own pipeline. The R API mirrors the Python API one-to-one — same names, same semantics; the only differences are R idioms (list instead of dict, character vector instead of list[str]).
The shape of the API — almost everything is one of three moves:
- On / off —
activate(name)turns patches on;deactivate(name)/deactivate_all()turn them off;with_disabled({ ... })turns them off for a single block. - Look —
status()(what’s on),list_patches()(what’s available),inspect(name)(detail on one),dashboard()(one-screen view). - Extras —
set_threads()(CPU threads),env_snapshot()(reproducibility record),speedups()(published numbers).
activate(name)
activate(name) -> logical | named logical
Activate one or more patches.
Parameters
name— patch name (character), bundle name, or character vector.
Returns
TRUEfor a single named patch that activated.- Named
logicalfor multiple (c(seurat = TRUE, cellchat = FALSE, ...)).
Example
activate("seurat") # TRUE
activate(c("seurat", "cellchat")) # c(seurat=TRUE, cellchat=TRUE)
activate("scrna_signaling") # bundle: activates 4 patches
deactivate(name)
deactivate(name) -> invisible(NULL)
Inverse of activate — rebinds upstream to its captured original. Patch stays registered for cheap re-activation.
deactivate_all()
deactivate_all() -> invisible(NULL)
Deactivate every active patch.
with_disabled(expr)
with_disabled({ ...expr... })
Evaluate expr with all patches temporarily disabled. Equivalent to Python’s with autozyme.disabled():. Works for namespace patches AND S4/class-method patches.
Example
with_disabled({
Seurat::FindAllMarkers(obj) # uses upstream original
Seurat::FindNeighbors(obj) # also original
})
inspect(name)
inspect(name) -> list
Returns a list with name, status, tested_against, installed_version, upstream, targets (list of per-target info). (An uninstalled patch returns name, status, error, targets instead.)
status()
status() -> named character
c(seurat = "active", cellchat = "inactive", ...).
list_patches(installed = FALSE)
list_patches(installed = FALSE) -> character
All shipped patches. With installed=TRUE, only those whose upstream is installed via requireNamespace(..., quietly=TRUE).
list_subsets()
list_subsets() -> character
Bundle names: c("scrna_signaling", "scrna_spatial", "scrna_trajectory").
subset_patches(name)
subset_patches(name) -> character
Member patch names of a bundle. R uses subset_patches (not subset) because base R has subset.default.
env_snapshot()
env_snapshot() -> list
Structured environment snapshot: autozyme version, R version, platform, and per-patch state (status, installed upstream versions, tested-against versions). Does not include BLAS or thread counts.
speedups(name, history = FALSE)
speedups(name, history = FALSE) -> data.frame
Published rows from the shipped finalized speedup data. With history=TRUE, returns every historical attest run.
set_threads(n)
set_threads(n) -> integer
Sets the BLAS/OpenMP env vars (OMP_NUM_THREADS, OPENBLAS_NUM_THREADS, MKL_NUM_THREADS, VECLIB_MAXIMUM_THREADS, NUMEXPR_NUM_THREADS), options(autozyme.threads = n), and — when installed — RhpcBLASctl / RcppParallel thread counts. Returns the value actually set. Rejects n <= 0.
dashboard()
dashboard() -> invisible(<env_snapshot list>)
Prints a one-screen status table to console: every patch, upstream availability, activation state, headline speedup. R equivalent of python -m autozyme.
Differences from the Python API
| Python | R | Why |
|---|---|---|
subset(name) | subset_patches(name) | Base R reserves subset() as an S3 generic on data.frame |
with autozyme.disabled(): | autozyme::with_disabled({ ... }) | R doesn’t have context managers — with_disabled takes a code block expression |
status() -> dict[str, str] | status() -> named character | R’s idiomatic equivalent |
Where the Python API has dict[str, X], R returns a named list or named vector — same data shape.