Skip to main content

atomr-accel (Python)

Python bindings for atomr-accel — drive an actor-supervised NVIDIA CUDA pipeline directly from Python without juggling streams, contexts, or hand-rolled retry loops.

import numpy as np
import atomr_accel

with atomr_accel.System.open("my-app") as sys:
    dev = sys.spawn_device(device_id=0)         # real CUDA device

    # Allocate two N×N f32 buffers on-device.
    n = 256
    a = dev.allocate_f32(n * n)
    b = dev.allocate_f32(n * n)
    c = dev.allocate_f32(n * n)

    # Upload from numpy.
    dev.copy_from_numpy(a, np.ones(n * n, dtype=np.float32))
    dev.copy_from_numpy(b, np.full(n * n, 2.0, dtype=np.float32))

    # Run cuBLAS SGEMM — the call blocks until the kernel finishes.
    # Either through the legacy alias on Device:
    dev.sgemm(a, b, c, m=n, n=n, k=n, alpha=1.0, beta=0.0)
    # …or the typed Blas handle (also supports gemm_f64, axpy_f32):
    blas = dev.blas()
    blas.gemm_f32(a, b, c, m=n, n=n, k=n)

    # Pull the result back into a fresh numpy array.
    result = dev.copy_to_numpy(c)
    print(result.reshape(n, n))

For hosts without a GPU, pass mock=True to spawn_device and the device replies Unrecoverable("...mock mode") for any kernel call — useful for testing the surrounding plumbing in CI.

Install

The wheel builds with maturin:

# from this directory
pip install maturin pytest numpy
maturin develop --release       # builds + installs into the active venv
pytest tests/                    # runs the no-GPU smoke suite

For a release wheel:

maturin build --release --no-default-features --features extension-module
# wheel lands in target/wheels/

The pure-Python facade (python/atomr_accel/__init__.py) re-exports the native classes and exception types. Downstream libraries import from atomr_accel and treat atomr_accel._native as private.

Feature flags

The Rust crate matches atomr-accel's feature gating so the wheel can be built minimal or full:

Feature Adds
(default) System, Device, GpuBuffer{F32,F64,I32,U32,U8}, Blas, exceptions
cudnn Cudnn handle (Device.cudnn(), conv2d_fwd_f32)
cufft Fft handle (Device.fft(), structural anchor)
curand RngGenerator handle (Device.rng(), set_seed, uniform_f32, normal_f32)
cusolver Solver handle (structural anchor; spawn path tracked)
nccl Collective handle (structural anchor; comm-group bootstrap tracked)
nvrtc NvrtcKernel (structural anchor; compile/launch tracked)
cublaslt (placeholder; future Python surface)
core-libs / training-libs / full-cuda aggregates
maturin develop --features atomr-accel-py/curand,atomr-accel-py/nvrtc

Public API

Class / function What it wraps
atomr_accel.System.open(name) A atomr_core::actor::ActorSystem lifetime
system.spawn_device(id, mock=) A DeviceActor (real or mock)
device.allocate_{f32,f64,i32,u32,u8}(len) Typed DeviceMsg::alloc::<T>GpuBuffer{T}
device.copy_from_numpy[_T](buf, np) H2D DeviceMsg::copy_from_host::<T>
device.copy_to_numpy[_T](buf) D2H DeviceMsg::copy_to_host::<T> → numpy
device.sgemm(a,b,c,m,n,k,...) cuBLAS SGEMM (legacy alias for blas.gemm_f32)
device.stats() DeviceMsg::StatsDeviceLoad
device.libraries_ready() KernelChildren snapshot probe
device.blas()Blas ActorRef<BlasMsg> handle
blas.gemm_f32 / gemm_f64 / axpy_f32 Typed BlasMsg::Gemm / BlasMsg::L1 dispatch
device.cudnn()Cudnn (feat: cudnn) ActorRef<CudnnMsg> handle
cudnn.conv2d_fwd_f32(x, w, y, ...) CudnnMsg::Op(ConvFwdRequest::<f32>)
device.fft()Fft (feat: cufft) ActorRef<FftMsg> handle (Phase 1 anchor)
device.rng()RngGenerator (feat: curand) ActorRef<RngMsg> handle
rng.set_seed / uniform_f32 / normal_f32 RngMsg::SetSeed / Fill(FillRequest::<f32>)
Solver, Collective (feat-gated) Handle classes; full method coverage in Phase 1.5
NvrtcKernel (feat: nvrtc) KernelHandle probe (Phase 1 stub)
GpuBuffer{T}.is_stale() / .dtype / .len Generation token check + dtype tag
GpuRuntimeError (and subclasses) Typed GpuError mapping

Every method blocks the calling thread until the underlying actor replies (the GIL is released for the duration via py.allow_threads). Async wrappers can be layered later via pyo3_async_runtimes::tokio::future_into_py.

How it works

Three pieces:

  1. A shared tokio runtime. The first call to System.open(...) initializes a multi-threaded scheduler; every subsequent call reuses it. Implemented in src/runtime.rs via pyo3-async-runtimes::tokio::init.
  2. The _native extension module. src/lib.rs registers System, Device, GpuBuffer, exceptions, and (feature-gated) RngGenerator / NvrtcKernel. Each Python class wraps a typed ActorRef<...> from atomr-accel and converts replies via errors::map_gpu.
  3. The pure-Python facade at python/atomr_accel/__init__.py. Hides _native; documents the API; gives downstream libraries a stable import path.

See docs/python-bridge.md for the full architecture write-up.

License

Apache-2.0.

Release files for atomr-accel 0.10.0

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

Source distribution (sdist)

Source distribution for atomr-accel 0.10.0
File Size Uploaded
atomr_accel-0.10.0.tar.gz 1.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for atomr-accel 0.10.0
File
atomr_accel-0.10.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
atomr_accel-0.10.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size:19.4 MB

Release files / atomr_accel-0.10.0.tar.gz

Download URL atomr_accel-0.10.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
0c34e2a7ba7e3de9a7026e2aa184bb12a27c715568703a915ec04b1109688eaa
BLAKE2b-256 checksum
How to use checksums
2e7fd048ab58acdb020912d02a3f073c9ddfa09de5b2199cb1ea8b5968e43213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-win_amd64.whl

Download URL atomr_accel-0.10.0-cp310-abi3-win_amd64.whl
Size 3.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0eb68be63c2f29b1c786d1455e503f6375ea77384f1ea52b3b174bc0f641dd7b
BLAKE2b-256 checksum
How to use checksums
0da0d9f744615a57c2a72f3b29d8465f19b1eb89eccdaad4fb6aebb44af12ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.8 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
2e3badafcc1e120f6890d437a1939d09abdf589ce8c57ddcdacfb1d53658fb1c
BLAKE2b-256 checksum
How to use checksums
4154455063f16f32522e4d8a5a266ab7a2a831b8c9983b826db3f2996e6e5d18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL atomr_accel-0.10.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.6 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
5076af6c99bb5b73bc5f9f8df432bdaad48e35192297eb4acecd3d71bf00ff03
BLAKE2b-256 checksum
How to use checksums
e387f257fd14b0334894d94230e9f1d6146209ae8585d6d70abb24d23cc3d828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.5 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d8fbd369ca1e7453d2030808fc7287283a82f07f971a0e07db3d4cc87e43336b
BLAKE2b-256 checksum
How to use checksums
9f97c21385800d340aa6ee46594fb227f0be1e97f2958ee97b2a07d8222005f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL atomr_accel-0.10.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.4 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4fa845b0ba385b1aa8a81b8fc0ca6751cd61a2b952724eefae5172400801b261
BLAKE2b-256 checksum
How to use checksums
4b2b62759e2cef01e12a7ca7583133728cc774072fcb1604b7394bcc6dcb304c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / atomr_accel-0.10.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL atomr_accel-0.10.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 4.7 MB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c8d3656289d07ff513c754d6601f0728d66ccb3a82d146a4dc5b4eca8bdb2238
BLAKE2b-256 checksum
How to use checksums
7ef66797d22b7bd94806f5b8387e5364a3733f3901181af7ce5b730435e5a3a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

7 release files

0.9.1

7 release files

0.4.2

7 release files

0.3.3

7 release files

0.3.2

7 release files

0.1.0

5 release files

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