Skip to main content

Actor-shaped face for compute-acceleration backends (NVIDIA CUDA shipping; ROCm / Metal / oneAPI / Vulkan future), on the atomr actor runtime.

Project description

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.
    dev.sgemm(a, b, c, m=n, n=n, k=n, alpha=1.0, beta=0.0)

    # 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, exceptions
curand RngGenerator
nvrtc NvrtcKernel
cudnn / cufft / cusolver / cublaslt / nccl placeholder; future Python surfaces
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(len) DeviceMsg::AllocateF32GpuBuffer
device.copy_from_numpy(buf, np) H2D CopyFromHostF32
device.copy_to_numpy(buf) D2H CopyToHostF32 → numpy float32 array
device.sgemm(a,b,c,m,n,k,...) cuBLAS SGEMM via BlasActor
device.stats() DeviceMsg::StatsDeviceLoad
GpuBuffer.is_stale() Generation token check vs. DeviceState
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.

Project details


Download files

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

Source Distribution

atomr_accel-0.3.2.tar.gz (785.5 kB view details)

Uploaded Source

Built Distributions

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

atomr_accel-0.3.2-cp310-abi3-win_amd64.whl (632.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl (899.0 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl (836.4 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (683.3 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (657.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

atomr_accel-0.3.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.2 MB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file atomr_accel-0.3.2.tar.gz.

File metadata

  • Download URL: atomr_accel-0.3.2.tar.gz
  • Upload date:
  • Size: 785.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atomr_accel-0.3.2.tar.gz
Algorithm Hash digest
SHA256 b7eeaf21b75f6406fc40a394c2b6679ecb0917c997ce798ce09460083415ea90
MD5 a261f287a12d353815863ad8172f6703
BLAKE2b-256 8f4e3c88fce297d126639150b43a412239af594b48089862901281888d5627a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2.tar.gz:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: atomr_accel-0.3.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 632.1 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3d021756e63a8da39749b77ef017b7b73f5dc8f4fdaf9c1dadfe5ecc240e83ad
MD5 489e0125d3b270f8a08f257ff54955ab
BLAKE2b-256 9c8529789146347fdf33b42a21dab755ad7da9a1446fcbb433ff956a546e6306

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-win_amd64.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 02e91ba87cd481f80f5596026125dff8f0e2d8ef3bc05dbc4d972ad0527befa2
MD5 cc7630c93bc70b4594ba85047d1e17cf
BLAKE2b-256 039987fa634ad27f361285b37918b05034aee415d9fd2be373e7d710bee17ebe

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4ecc9c098afc63d1d1259b80a61dd745b5ee73df3ff32d079bfaa455b2e4dee1
MD5 0d42d9c056119e92ce308325959685e4
BLAKE2b-256 c19d0131cfe7523c3c97c642e1712a23afddfd684543ba200c1f9ac3fed29442

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95e5adb1a94bfa344fbe86d42ba7e61227a799890e5564b41099447d523d142f
MD5 b4df6ea468c22343532c7d56b02d5516
BLAKE2b-256 e6a8a7df7d1c57ccaf116c189f1c10f74b5630122810131cad770ea221c351aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 176aa5e49017bab782f850d0bc861dd1f6b3f142d1fb3ec0780281fe55d405f4
MD5 19b86352843735f560df0193d6041f03
BLAKE2b-256 1f416d0f7cb111ceaa1a49f05c47b3d6e4731a0b0bc0d8a36cd3df63494de4b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_accel-0.3.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for atomr_accel-0.3.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9900765589351c686bf598e2bf6f14d9449e9a63a01f46537e866af13155de42
MD5 9b19254a65590f69853ef7faf0fec4d5
BLAKE2b-256 3f1f13acdcd57fee92032cb28bda511fa0ed4d6dc381959fa9936b2805dd4afa

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_accel-0.3.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on rustakka/atomr-accel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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