Skip to main content

High-performance Python acceleration engine — CPU, threads, virtual threads, multi-GPU, NPU and virtualization.

Project description

PyAccelerate

High-performance Python acceleration engine — CPU, threads, virtual threads, multi-GPU and virtualization.

CI Python 3.10+ License: MIT


Features

Module Description
cpu CPU detection, topology, NUMA, affinity, ISA flags, dynamic worker recommendations
threads Persistent virtual-thread pool, sliding-window executor, async bridge, process pool
gpu Multi-vendor GPU detection (NVIDIA/CUDA, AMD/OpenCL, Intel oneAPI), ranking, multi-GPU dispatch
virt Virtualization detection (Hyper-V, VT-x/AMD-V, KVM, WSL2, Docker, container detection)
memory Memory pressure monitoring, automatic worker clamping, reusable buffer pool
profiler @timed, @profile_memory decorators, Timer context manager, Tracker statistics
benchmark Built-in micro-benchmarks (CPU, threads, memory bandwidth, GPU compute)
engine Unified orchestrator — auto-detects everything and provides a single API

Quick Start

pip install pyaccelerate
from pyaccelerate import Engine

engine = Engine()
print(engine.summary())

# Submit I/O-bound tasks to the virtual thread pool
future = engine.submit(my_io_func, arg1, arg2)

# Run many tasks with auto-tuned concurrency
engine.run_parallel(process_file, [(f,) for f in files])

# GPU dispatch (auto-fallback to CPU)
results = engine.gpu_dispatch(my_kernel, data_chunks)

CLI

pyaccelerate info          # Full hardware report
pyaccelerate benchmark     # Run micro-benchmarks
pyaccelerate gpu           # GPU details
pyaccelerate cpu           # CPU details
pyaccelerate virt          # Virtualization info
pyaccelerate memory        # Memory stats
pyaccelerate status        # One-liner

Modules in Depth

Virtual Thread Pool

Inspired by Java's virtual threads — a persistent ThreadPoolExecutor sized for I/O (cores × 3, cap 32). All I/O-bound work shares this pool instead of creating/destroying threads per operation.

from pyaccelerate.threads import get_pool, run_parallel, submit

# Single task
fut = submit(download_file, url)

# Bounded concurrency (sliding window)
run_parallel(process, [(item,) for item in items], max_concurrent=8)

Multi-GPU Dispatch

Auto-detects GPUs across CUDA, OpenCL and Intel oneAPI. Distributes workloads with configurable strategies.

from pyaccelerate.gpu import detect_all, dispatch

gpus = detect_all()
results = dispatch(my_kernel, data_chunks, strategy="score-weighted")

Profiling

Zero-config decorators for timing and memory tracking:

from pyaccelerate.profiler import timed, profile_memory, Tracker

@timed(level=logging.INFO)
def heavy_computation():
    ...

tracker = Tracker("db_queries")
for batch in batches:
    with tracker.measure():
        run_query(batch)
print(tracker.summary())

Installation Options

# Core (CPU + threads + memory + virt)
pip install pyaccelerate

# With NVIDIA GPU support
pip install pyaccelerate[cuda]

# With OpenCL support (AMD/Intel/NVIDIA)
pip install pyaccelerate[opencl]

# With Intel oneAPI support
pip install pyaccelerate[intel]

# All GPU backends
pip install pyaccelerate[all-gpu]

# Development
pip install pyaccelerate[dev]

Docker

# CPU-only
docker build -t pyaccelerate .
docker run --rm pyaccelerate info

# With NVIDIA GPU
docker build -f Dockerfile.gpu -t pyaccelerate:gpu .
docker run --rm --gpus all pyaccelerate:gpu info

# Docker Compose
docker compose up pyaccelerate    # CPU
docker compose up gpu             # GPU

Development

git clone https://github.com/GuilhermeP96/pyaccelerate.git
cd pyaccelerate
pip install -e ".[dev]"

# Run tests
pytest -v

# Lint + format
ruff check src/ tests/
ruff format src/ tests/

# Type check
mypy src/

# Build wheel
python -m build

Architecture

pyaccelerate/
├── cpu.py          # CPU detection & topology
├── threads.py      # Virtual thread pool & executors
├── gpu/
│   ├── detector.py # Multi-vendor GPU enumeration
│   ├── cuda.py     # CUDA/CuPy helpers
│   ├── opencl.py   # PyOpenCL helpers
│   ├── intel.py    # Intel oneAPI helpers
│   └── dispatch.py # Multi-GPU load balancer
├── virt.py         # Virtualization detection
├── memory.py       # Memory monitoring & buffer pool
├── profiler.py     # Timing & profiling utilities
├── benchmark.py    # Built-in micro-benchmarks
├── engine.py       # Unified orchestrator
└── cli.py          # Command-line interface

Roadmap

  • npm package (Node.js bindings via pybind11/napi)
  • gRPC server mode for multi-language integration
  • Kubernetes operator for auto-scaling GPU workloads
  • Prometheus metrics exporter
  • Auto-tuning feedback loop (benchmark → config → re-tune)

Origin

Evolved from the acceleration & virtual-thread systems built for:

License

MIT — see LICENSE.

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

pyaccelerate-0.2.0.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

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

pyaccelerate-0.2.0-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file pyaccelerate-0.2.0.tar.gz.

File metadata

  • Download URL: pyaccelerate-0.2.0.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyaccelerate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dd7e7b32c9f1dbdad870ff21fb53b17c996899d7316c99af424fa822aea38dba
MD5 40f9b694a414d194dbfac61cd89e7e0c
BLAKE2b-256 4f2576f26dbed6171af5f259b48ae348b4a5fe82b43daf5361a7f0dbd0d264fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyaccelerate-0.2.0.tar.gz:

Publisher: publish.yml on GuilhermeP96/pyaccelerate

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

File details

Details for the file pyaccelerate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyaccelerate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 53.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyaccelerate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7472dbf6aa4d872e0e33755a2dd7539204fa9be330c694a03428352940109100
MD5 d0db7e1eba5d40359334ddd418b4305b
BLAKE2b-256 83ca8729f3394879fd55846b9c28507ad97bea320aba86eb5e6ebe557bb76ed2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyaccelerate-0.2.0-py3-none-any.whl:

Publisher: publish.yml on GuilhermeP96/pyaccelerate

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