Skip to main content

computeml — Python bindings

Python API for ComputeML: ML inference and training on any GPU via Vulkan compute shaders. Pure-Python ctypes binding over libcomputeml.so — no compilation step, only NumPy required.

Setup

# 1. Build the shared library (embeds all SPIR-V shaders)
cmake -B build -S . && cmake --build build --target computeml_shared

# 2. Install the package (editable, from repo root)
pip install -e python/

The binding finds the library via $COMPUTEML_LIB, a bundled copy next to the package, or <repo>/build/libcomputeml.so.

Usage

import computeml as cml
import numpy as np

ctx = cml.Context()                 # or Context(backend="vulkan")
print(ctx.backend)                  # "Vulkan"

a = ctx.from_numpy(np.random.rand(512, 512).astype(np.float32))
b = ctx.from_numpy(np.random.rand(512, 512).astype(np.float32))
c = cml.ops.matmul(a, b)            # recorded on GPU
print(c.numpy())                    # flush + download

# Quantized weights
w_q8 = b.quantize(cml.Dtype.Q8_0)
c2 = cml.ops.matmul(a, w_q8)        # dequantizes in-register on GPU

Ops are recorded into a command buffer and submitted on ctx.flush() — Tensor.numpy() flushes implicitly. Available ops: element-wise math, matmul (fp32/fp16/Q8/Q4), softmax, layernorm/rmsnorm, fused linear+activation, flash attention (multi-head, causal), RoPE, embeddings, reductions — see computeml/ops.py.

Models

from computeml.models import BertEncoder

enc = BertEncoder(ctx, "models/bert-tiny")   # weights from scripts/export_bert_tiny.py
hidden = enc.forward([101, 7592, 2088, 102]) # (seq, hidden) np.ndarray

Tests

python -m pytest python/tests/ -v

test_ops.py checks GPU ops against NumPy references; test_bert.py checks BERT-tiny end-to-end numerical equivalence against HuggingFace PyTorch.

Metadata

Release files for computeml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for computeml 0.1.0
File Interpreter ABI Platform
computeml-0.1.0-py3-none-manylinux_2_27_x86_64.whl Python 3 none Linux glibc 2.27+ x86-64 Details

Release files / computeml-0.1.0-py3-none-manylinux_2_27_x86_64.whl

Download URL computeml-0.1.0-py3-none-manylinux_2_27_x86_64.whl
Size 331.4 kB
Tags Linux glibc 2.27+ x86-64 Python 3
SHA-256 checksum
How to use checksums
501be78658e88ffe1818e966b2a1d29d82d57872689bc83ebe3ebe5d84acb67c
BLAKE2b-256 checksum
How to use checksums
764d37961c9c1ce9a5e1a5666b9744cb8b0e492b02f1e134d1535d6509ba30ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for computeml 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page