Skip to main content

NumPy-like GPU array library that works on every GPU — NVIDIA, AMD, Intel, Apple Silicon. No CUDA required.

Project description

gpuarray

NumPy-like GPU array library that works on every GPU — NVIDIA, AMD, Intel, Apple Silicon. No CUDA required.

Powered by WebGPU via wgpu-py. Uses Metal on macOS, Vulkan on Windows/Linux, and DirectX 12 on Windows.

Install

pip install gpuarray

Usage

import gpuarray as gp

# Create arrays on GPU
a = gp.array([1, 2, 3, 4, 5])
b = gp.ones(5) * 3

# Operations run on GPU
c = a + b
d = a * b
e = gp.dot(a, b)

# Read back to CPU
print(c.to_numpy())  # [4. 5. 6. 7. 8.]

# Matrix multiply
A = gp.ones((512, 512))
B = gp.ones((512, 512))
C = gp.matmul(A, B)  # runs on GPU

# Reductions
total = gp.sum(a)
avg = gp.mean(a)

# Math functions
x = gp.exp(a)
y = gp.log(a)
z = gp.sqrt(a)

Why?

CuPy only works on NVIDIA GPUs with CUDA. gpuarray works on every GPU:

GPU CuPy gpuarray
NVIDIA (CUDA)
AMD (Vulkan)
Intel (Vulkan)
Apple Silicon (Metal)

Supported Operations

Array Creation

array, zeros, ones, arange, linspace

Elementwise Binary

+, -, *, /, ** (with arrays or scalars)

Elementwise Unary

exp, log, sqrt, abs, neg, relu, sigmoid, tanh

Reductions

sum, mean, max, min

Linear Algebra

dot, matmul

Performance

Benchmarks on Intel UHD 630 (integrated GPU) vs NumPy (CPU with SIMD):

Operation NumPy gpuarray Speedup
add 10M elements 11.6ms 19.9ms 0.59x
matmul 512x512 1.3ms 1.0ms 1.22x
sum 10M 4.3ms 12.5ms 0.34x

The integrated GPU shows speedup on compute-heavy operations (matmul). Discrete GPUs (RTX 3080, RX 7900, etc.) will show much larger speedups across all operations.

Requirements

  • Python 3.10-3.13
  • Any GPU supported by WebGPU (most GPUs from 2015+)
  • No CUDA, no special drivers — just your system GPU

How It Works

  1. Arrays are stored as WebGPU GPU buffers
  2. Operations dispatch WGSL compute shaders to the GPU
  3. Pipelines are cached — repeated operations don't recompile
  4. Results stay on GPU until you call .to_numpy()

License

MIT

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

gpuarray-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

gpuarray-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file gpuarray-0.1.0.tar.gz.

File metadata

  • Download URL: gpuarray-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for gpuarray-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0093256bcd3565b88d5459463d219b6f0e6409612fa27f730694dcd3721b170c
MD5 e7c56337e4c414cfa34c7f12bef3bcdc
BLAKE2b-256 6017fe7c67f296a07a400507e886c1a8abee1f9f38dca632cab3d342708989b9

See more details on using hashes here.

File details

Details for the file gpuarray-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gpuarray-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for gpuarray-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c91a60f498bab0a2318564f3d1a0462df400c9312692abd0cc74998c56a4c67
MD5 6594e30a97ac2b58bf65c2e27bde8d98
BLAKE2b-256 a9debf42c5b57fc5afa85adaeb71b603735b051d1fc5b5e894dbf05bd39e2e86

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