Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
onemkl
Safe, idiomatic Rust wrapper over Intel oneAPI Math Kernel Library (oneMKL).
Built on top of onemkl-sys, which provides the raw FFI
bindings.
What's covered
Every major oneMKL domain has a safe Rust wrapper. Some highlights, by audience:
For ML inference / training
- Mixed-precision GEMM (
blas::mixed_precision):gemm_bf16_f32,gemm_f16_f32,gemm_e5m2_f32,gemm_e4m3_f32(FP8 for both activations and weights),gemm_s8u8_s32,gemm_s16_s32(quantized inference),hgemm(pure fp16). - JIT GEMM (
blas::jit): runtime-specialized small kernels for transformer attention heads, MLP blocks, and any shape-stable hot loop. - Pack / compute (
blas::packed): pre-pack a fixed weight matrix once and amortize the data reordering across many input batches. - Compact BLAS (
blas::compact): SIMD-packed batched kernels for many independent small matrices in lockstep. - Pointer-array batched GEMM / GEMV / TRSM (
blas::extensions): the canonical batched dispatch model.
For scientific computing
- Direct sparse solvers: [
pardiso] (withpardiso_64, save / restore handle, custom pivot callback, diagonal extraction) and [dss] (with timing / memory / determinant / inertia statistics). - Iterative sparse solvers (
iss): CG and FGMRES with closure matvec, optional preconditioning, and a step-by-stepCgSession/FgmresSessionAPI for callers driving the loop themselves. - Sparse manipulation (
sparse): CSR / COO / CSC / BSR construction, conversion between formats, sparse arithmetic (add/spmm/spmmd), iterative-solver primitives (dot_mv,symgs,symgs_mv). - Eigensolvers: [
lapack] (general, symmetric, Hermitian, banded, packed, generalized, divide-and-conquer, RRR) and [feast] (contour-integration solver for dense / CSR / banded / generalized problems). - FFT (
fft): 1-D / 2-D / 3-D / N-D complex and real-input transforms, configurable forward / backward scaling. - PDE building blocks (
pde): trigonometric transforms (DCT, DST, four staggered variants) for spectral PDE solvers. - Data fitting (
data_fitting): natural / Bessel / Akima / Hermite cubic splines. - Nonlinear optimization (
optim): trust-region nonlinear least squares (TRNLS) with bound constraints, plus numerical Jacobian. - Random numbers (
rng): Mersenne Twister, Philox4x32x10, MT2203, R250, and others; full set of continuous and discrete distributions; 1-D convolution / correlation; multivariate summary statistics. - Vector math (
vm): element-wise transcendentals.
See the crate-level rustdoc for the per-domain reference.
Quick example
use *;
use gemm;
// Compute C = A * B for two 2×2 matrices.
let a_data = vec!;
let b_data = vec!;
let mut c_data = vec!;
let a = new?;
let b = new?;
let mut c = new?;
gemm?;
// c_data ≈ [19, 22, 43, 50]
# Ok::
More examples
The examples/ directory contains short standalone programs for
common patterns:
solve_linear_system— LAPACKgesvforA x = b.sparse_cg— Conjugate Gradient on a sparse SPD matrix.fft_signal— real-input FFT to find a peak frequency.quantized_inference— int8 × uint8 → int32 GEMM with bias for quantized DL.transformer_qkv_projection— JIT GEMM driving Q / K / V projections in a transformer layer.
Run any example with cargo run --example <name>.
Cargo features
Each major oneMKL domain is gated by a feature so projects can opt out of unused parts. All domain features are enabled by default.
| Feature | Module |
|---|---|
blas |
blas |
data-fitting |
data_fitting |
dss |
dss |
feast |
feast |
fft |
fft |
iss |
iss |
lapack |
lapack |
optim |
optim |
pardiso |
pardiso |
pde |
pde |
preconditioners |
preconditioners |
rng |
rng |
sparse |
sparse |
vm |
vm |
Build configuration (one from each group must be selected; defaults shown):
- Interface:
lp64(default) orilp64. - Threading:
threading-sequential(default),threading-intel-openmp, orthreading-tbb. - Linkage:
link-dynamic(default) orlink-static.
For a minimal build with only BLAS and LAPACK:
= { = "0.1", = false, = [
"lp64", "threading-sequential", "link-dynamic",
"blas", "lapack",
]}
Building against MKL
The build script in onemkl-sys looks for MKL in this order:
MKLROOTenvironment variable.ONEMKL_SYS_INCLUDE_DIR/ONEMKL_SYS_LIB_DIRoverrides.ONEAPI_ROOT/mkl/latest.- Platform-standard paths (
C:\Program Files (x86)\Intel\oneAPIon Windows,/opt/intel/oneapion Linux/macOS).
At runtime, MKL's bin/ (Windows) or lib/ (Linux/macOS) directory
must be on the loader search path.
Anything not yet wrapped
Reachable through onemkl::sys (the raw onemkl-sys re-export).
See ROADMAP.md for what's planned per release.
License
Dual-licensed under MIT or Apache-2.0, at your option.