numr

Library Listed

The base for numerical code in Rust, in the role NumPy has in Python: n-dimensional tensors, linear algebra, FFT, statistics and autograd on CPU, CUDA and WebGPU. The backends use native kernels, with no cuBLAS, MKL or other vendor math library.

Checked · Sources

Downloads
1,673
Dependents
7
Stars
59
Forks
1
Contributors
3
Commits
1,149
Latest release
0.15.2 ·

About

From the project README ·

Numerical computing in Rust. Write once. Run on any backend.

N-dimensional tensors, linear algebra, FFT, statistics, and autograd on CPU, CUDA, and WebGPU. The backends use native kernels, with no cuBLAS, MKL, or other vendor math library.

Docs · Crate · Backends · Install · Example · Operations · Contributing

numr is a tensor and numerical computing library for Rust. It fills the role NumPy has in Python, and it also runs on GPUs. Tensors are generic over a Runtime. Switching from CPU to CUDA or WebGPU changes the runtime type. Generic functions keep their body, and gain new backends when numr adds them.

  • Pure Rust on CPU and WebGPU. No Python is needed. The CUDA backend compiles its .cu kernels with nvcc at build time.
  • numr is the base of solvr (SciPy role) and boostr (ML framework).

Not supported yet:

  • ROCm.
  • WebGPU computes in F32 only.
Read the full README

Backends

RuntimeHardwareFeatureNeedsDtypes
CpuRuntimex86-64 and ARM64 CPUsNone, always builtNothingAll 15. F16 and BF16 need f16. FP8 types need fp8
CudaRuntimeNVIDIA GPUs, compute capability 7.5 (Turing) or newercudaCUDA toolkit 12.8 or newer, with nvcc on PATH or CUDA_PATH setSame as CPU
WgpuRuntimeVulkan, Metal, and DX12 GPUswgpuPlatform GPU driverF32 for computation. cast runs on the GPU among F32, I32, U32, and I64. Other dtypes return Error::UnsupportedDType
  • Kernels: SIMD on CPU (AVX-512, AVX2, NEON), native CUDA kernels, and WGSL compute shaders. No cuBLAS, MKL, or other vendor library.
  • ROCm: not implemented.
  • Dtype coverage: the table lists what a backend holds. Check the operation before you rely on a dtype.
  • CUDA binaries: a build targets the GPUs on the build host. Set NUMR_CUDA_ARCH=all for a binary that runs on another machine.
  • Details: the dtype table, SIMD, graph capture, and every NUMR_CUDA_ARCH value are in docs/backends.md. The CUDA build steps are in CUDA Build.

Installation

Needs Rust 1.95 or newer.

cargo add numr                   # CPU
cargo add numr --features cuda   # NVIDIA GPUs
cargo add numr --features wgpu   # WebGPU

Other feature flags:

FeatureDescriptionDefault
rayonMulti-threaded CPU through Rayon✓
f16F16 and BF16 types✗
fp8FP8 types (E4M3, E5M2)✗
sparseSparse tensors (CSR, CSC, COO) and sparse linear algebra✗
ncclMulti-GPU collectives through NCCL (implies cuda)✗
distributedMulti-machine communication through nexar✗
distributed-gpuNCCL within a node, nexar between nodes (implies distributed and nccl)✗

What numr Is

numr provides:

  • Tensors: N-dimensional arrays
  • Linear algebra: decompositions and solvers
  • FFT, statistics, and random distributions
  • Autograd

numr is not a deep learning framework, a high-level ML API, or domain-specific.

You needUse
Optimization, ODE solvers, interpolation, signal processingsolvr
Attention, model architectures, quantization, trainingboostr

Quick Start

CPU
use numr::prelude::*;
use numr::runtime::cpu::{CpuDevice, CpuRuntime};

fn main() -> Result<()> {
    let device = CpuDevice::new();

    let a = Tensor::<CpuRuntime>::from_slice(&[1.0_f32, 2.0, 3.0, 4.0], &[2, 2], &device)?;
    let b = Tensor::<CpuRuntime>::from_slice(&[5.0_f32, 6.0, 7.0, 8.0], &[2, 2], &device)?;

    // Arithmetic with broadcasting
    let c = a.add(&b)?;
    let d = a.mul(&b)?;

    // Matrix multiplication
    let e = a.matmul(&b)?;

    // Reductions: dims, keepdim
    let sum = c.sum(&[0, 1], false)?;
    let max = c.max(&[0, 1], false)?;

    // Element-wise functions
    let exp = a.exp()?;
    let sqrt = a.sqrt()?;

    // Reshape and transpose
    let flat = c.reshape(&[4])?;
    let transposed = c.transpose(0, 1)?;

    println!("{:?}", c.to_vec::<f32>());
    Ok(())
}
Backend-Generic Code

Write functions over R: Runtime. The same function runs on any backend.

use numr::prelude::*;

fn matrix_operations<R>(a: &Tensor<R>, b: &Tensor<R>, client: &R::Client) -> Result<Tensor<R>>
where
    R: Runtime,
    R::Client: BinaryOps<R> + MatmulOps<R> + ReduceOps<R>,
{
    let c = client.add(a, b)?;
    let d = client.matmul(&c, a)?;
    client.sum(&d, &[0, 1], false)
}
GPU (CUDA)
use numr::ops::RandomOps;
use numr::prelude::*;
use numr::runtime::cuda::{CudaClient, CudaRuntime};

fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
    let device = CudaRuntime::default_device();
    let client = CudaClient::new(device.clone())?;

    let a = client.randn(&[1024, 1024], DType::F32)?;
    let b = client.randn(&[1024, 1024], DType::F32)?;

    // Runs on the GPU through native CUDA kernels
    let c = client.matmul(&a, &b)?;

    // Copy the result to the host
    let host = c.try_to_vec::<f32>()?;
    Ok(())
}

The module docs cover the rest of the API:

Operations

numr provides tensor operations as traits in numr::ops. The same traits cover CPU, CUDA, and WebGPU. The full list is in docs/operations.md:

  • Core arithmetic: unary, binary, scalar, type conversion, utility
  • Shape and data movement: cat, stack, gather, scatter, sort, topk, and more
  • Reductions, cumulative operations, comparisons, and logic
  • Activations, normalization, convolution, einsum, and matmul with fused bias and activation
  • Linear algebra and complex operations
  • Statistics, random distributions, and quasi-random sequences
  • Distance metrics on tensors and on plain slices

The algorithm modules are in docs/algorithms.md:

  • Linear algebra decompositions, matrix functions, and solvers
  • FFT and real FFT
  • Special functions and polynomials
  • Iterative solvers and preconditioners
  • Sparse tensors (CSR, CSC, COO) and sparse linear algebra

For NumPy Users

Most numr operations are methods on the backend client, such as client.sum(&a, &[0], false). Import numr::prelude::*. The traits named below are in the prelude unless a row says otherwise.

NumPynumr
np.array(data).reshape(shape)Tensor::from_slice(&data, &shape, &device)
np.zeros, np.onesTensor::zeros, Tensor::ones
np.fullTensor::full_scalar
np.arange, np.linspace, np.eyeUtilityOps: arange, linspace, eye
np.meshgridUtilityOps::meshgrid
a + b, a * b with broadcastinga.add(&b), a.mul(&b), or BinaryOps
np.exp, np.sqrt, np.sin, np.absa.exp(), a.sqrt(), a.sin(), a.abs(), or UnaryOps
np.clipUtilityOps::clamp
np.isnanUnaryOps::isnan
a @ b, np.matmula.matmul(&b), or MatmulOps::matmul
np.einsumEinsumOps::einsum
a.reshape, a.T, np.transpose, np.squeezereshape, transpose, permute, squeeze, unsqueeze
np.concatenate, np.stackTensor::cat, Tensor::stack
np.split, np.repeat, np.roll, np.padShapeOps: split, chunk, repeat, roll, pad
a.sum, a.mean, a.max, a.minReduceOps: sum, mean, max, min
np.argmax, np.argminIndexingOps::argmax, argmin
np.cumsum, np.cumprod, scipy.special.logsumexpCumulativeOps: cumsum, cumprod, logsumexp
np.sort, np.argsort, np.unique, np.searchsortedSortingOps: sort, argsort, unique, searchsorted
np.nonzero, np.where(cond, x, y)SortingOps::nonzero, ConditionalOps::where_cond
np.take_along_axisIndexingOps::gather
np.var, np.std, np.median, np.percentile, np.histogramStatisticalOps: var, std, median, percentile, histogram
np.cov, np.corrcoefStatisticalOps::cov, corrcoef
np.random.rand, randn, randint, permutationRandomOps: rand, randn, randint, randperm
np.random.seednumr::random::manual_seed
np.linalg.solve, inv, det, lstsqLinalgOps: solve, inverse, det, lstsq
np.trace, np.kron, np.trilLinalgOps: trace, kron, tril
np.linalg.svd, qr, cholesky, eignumr::algorithm::linalg::LinearAlgebraAlgorithms: svd_decompose, qr_decompose, cholesky_decompose, eig_decompose
np.fft.fft, rfft, fftfreqFftAlgorithms: fft, rfft, fftfreq

NumPy has no equivalent for autograd, CUDA and WebGPU execution, or the fused ML operations. Those are in Operations.

Documentation

PageContents
docs/operations.mdTensor operation traits and distance metrics
docs/algorithms.mdDecompositions, FFT, special functions, solvers, sparse
docs/autograd.mdReverse-mode and forward-mode autodiff, checkpointing
docs/backends.mdBackends, dtypes, SIMD, graph capture, CUDA build
docs/distributed.mdCommunicators and parallel groups
docs/extending-numr.mdCustom kernels and new operations
docs/ARCHITECTURE_GUIDE.mdInternal architecture for contributors

Building from Source

cargo build --release                    # CPU (default)
cargo build --release --features cuda    # CUDA
cargo build --release --features wgpu    # WebGPU
cargo test --release                     # Tests
cargo bench                              # Benchmarks

Contributing

Contributions are welcome. See CONTRIBUTING.md for conventions and checks.

Questions and design discussion happen on Discord.

License

Licensed under Apache-2.0. See LICENSE.

Runs on
CUDA, WebGPU
What shows it
  • CUDA: numr feature cuda (dependency cudarc)
  • WebGPU: numr feature wgpu (dependency wgpu)
Native code
Optional
  • Binds native code: ring (feature distributed)
Python bindings
No Python binding crate found
License
Apache-2.0

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days.

numr beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
numr This page Listed

The base for numerical code in Rust, in the role NumPy has in Python: n-dimensional tensors, linear algebra, FFT, statistics and autograd on CPU, CUDA and WebGPU. The backends use native kernels, with no cuBLAS, MKL or other vendor math library.

1,673 downloads over 30 days 7 59 0.15.2 CUDA, WebGPU Binds native code: ring (feature distributed) Apache-2.0
cubecl Featured

Multi-platform high-performance compute language extension for Rust.

Also in Tensors and GPU compute.

523,446 downloads over 30 days 145 2,490 0.11.3 CUDA, WebGPU, Metal, ROCm, Vulkan Binds native code: cubecl-hip-sys (feature hip), llvm-sys (feature cpu), tracy-client-sys (feature profile-tracy) Apache-2.0 OR MIT
peroxide Listed

Rust comprehensive scientific computation library contains linear algebra, numerical analysis, statistics and machine learning tools with familiar syntax

Python bindings

Also in Math and science.

56,548 downloads over 30 days 9 732 0.43.1 GPU support unknown Binds native code: openblas-src (feature O3-openblas-system), blas-sys (feature O3), hdf5-metno-sys (feature nc), lapack-sys (feature O3), libz-sys (feature nc) and 1 more Apache-2.0 OR MIT
oxicuda Listed

OxiCUDA replaces the entire NVIDIA CUDA Toolkit software stack with type-safe, memory-safe Rust code.

Also in Tensors and GPU compute.

65 downloads over 30 days 36 145 0.5.5 WebGPU, Metal, ROCm, Vulkan No native code found Apache-2.0
solvr Listed

Scientific computing on numr, in the role SciPy has in Python, with a module map for SciPy users: optimization, ODE, DAE and PDE solvers, interpolation, statistics, signal processing, spatial algorithms and clustering.

Also in Math and science.

31 downloads over 30 days 0 11 0.3.1 CUDA, WebGPU No native code found Apache-2.0
wgmath App Listed

GPU scientific computing on every platform

Also in Math and science.

Not measured Not applicable 150 Not measured Not measured Not measured Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 59 stars, 1 fork and 3 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

  • The last activity is on 6 Nov 2026, 3 days ago. The rules expect an update within 365 days. Dormancy rule

Check notes

  • the latest release was packaged from a dirty working tree

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.15.2 base 300, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-11-06, 3 days ago, E = 365: active
  • featured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 59 (needs 4539), forks 1 (needs 434), contributors 3 (needs 79)
  • listed: listed: no archive, new or featured rule applies

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 3 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-06GitHub repositoryYes
Latest release2026-11-06crates.io database dumpYes
First release2026-02-09crates.io database dumpYes
Latest version0.15.2crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days7GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution21 releases, 1,673 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases21crates.io database dumpYes
Downloads over 30 days1673crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository59 stars, 1 forks, 3 contributors, 1,149 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars59GitHub repositoryYes — one part of the repository route
GitHub forks1GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account3GitHub contributorsYes — one part of the repository route
Commits on the default branch1149GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesCUDA, WebGPUcrates.io database dumpNo
What shows each backendCUDA: numr feature cuda (dependency cudarc); WebGPU: numr feature wgpu (dependency wgpu)crates.io database dumpNo
Native code, from listed crates and their dependenciesBinds native code: ring (feature distributed)crates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly7crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.