Skip to main content

Fast SIMD-optimized dot products (f32·f32, f16·f32)

Project description

fast_dot

Fast SIMD-optimized dot products exposed to Python via PyO3 + maturin.

Features

  • dot_f32(a: np.ndarray[float32], b: np.ndarray[float32]) -> float
  • dot_f16_f32(a: np.ndarray[float16], b: np.ndarray[float32]) -> float (uses F16C when available)

Both functions accept any Python object that implements the buffer protocol (NumPy arrays, PyTorch tensors via .numpy() if on CPU and contiguous) through the NumPy bridge. For non-NumPy objects, convert to NumPy first.

Build and install

  • Build wheel: maturin build --release
  • Develop install: maturin develop --release

Usage

import numpy as np import fast_dot as fd

x = np.random.rand(1024).astype(np.float32) y = np.random.rand(1024).astype(np.float32) print(fd.dot_f32(x, y))

x16 = x.astype(np.float16) print(fd.dot_f16_f32(x16, y))

Notes

  • Requires x86_64. F16C and AVX2 paths are used when available; otherwise falls back to scalar.
  • Arrays must be 1-D and contiguous with matching shapes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastdotrs-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl (243.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

Details for the file fastdotrs-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fastdotrs-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8a6010bc69ebe13a6d13aef6b8c52e013b6422a3a5885a75f064b187f0318fa2
MD5 f2b0bf608f555ac3bfcbaae4cc7e75bd
BLAKE2b-256 1ce1e06038ddeb526ba5806e58fda71fa9a729b51a5ae637b6b611f53104e6d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page