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.2.0.tar.gz (12.5 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.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gpuarray-0.2.0.tar.gz
Algorithm Hash digest
SHA256 77a0a96321dbbfab210a0a7ccfee59bdd88fd0f63d0c317fa966c967df730b5a
MD5 14caadb6ddeb69356177688128a11908
BLAKE2b-256 4cc794b5b48350cf755ecbf727796ba369f0d7465b7e56bb57568b62e6afa6c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gpuarray-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04066682c429aa88a8761e9587a939bdbe388dedf18e769733ba7ced0dc4c9d5
MD5 1565da123ef6af4a68be66c090245807
BLAKE2b-256 43c71b402b4d523dce2d782e4b0a6381cb57feeccface61472884cd70d3697db

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