Skip to main content

Aakaar

Aakaar is a custom, standalone deep learning tensor library built from the ground up using Python, C++, and raw CUDA. It is designed to provide a lightweight, transparent architecture for high-performance GPU computations without relying on heavy external frameworks like PyTorch or TensorFlow.

Core Architecture

Aakaar bypasses standard NumPy arrays by implementing a custom C++ Tensor object that can live directly in GPU VRAM. Python interacts with this data via pybind11, acting as a lightweight remote control. This prevents severe performance bottlenecks over the PCI-e bus, keeping data on the GPU until explicitly requested back to the host with .to_numpy().

Tensors carry their own shape and strides, so operations like slicing return lightweight views into the same underlying memory rather than copies — no data movement happens until you actually ask for it.

Current capabilities

  • N-dimensional GPU-native and CPU Tensor objects with full lifecycle management
  • CUDA-accelerated uniform random number generation via cuRAND
  • Matrix multiplication via cuBLAS (GPU) with a CPU fallback path
  • NumPy-style indexing and slicing (t[i], t[1:3], t[1:3, 2:4], negative indices, step slicing) that returns zero-copy views on both CPU and GPU
  • Automatic CPU fallback: if no CUDA toolkit is available at install time, Aakaar builds a CPU-only extension so device="cpu" still works everywhere
  • Direct host-to-device and device-to-host memory mapping via .to_numpy()

Installation

pip install aakaar

Prebuilt wheels are available for Windows (Python 3.10–3.14, with CUDA support). On other platforms, pip will build Aakaar from source — this requires a C++ compiler (e.g. g++) for CPU-only support, and additionally the NVIDIA CUDA Toolkit (nvcc) if you want GPU acceleration. If no CUDA toolkit is found at install time, Aakaar automatically builds a CPU-only extension and device="cuda" calls will raise a clear error instead of failing to install.

Quick start

import aakaar

# Create a tensor of random values, on CPU or CUDA
a = aakaar.rand((4, 5), device="cpu", seed=1337)
print(a)
# aakaar.Tensor([...], device='cpu', shape=(4, 5))

print(a.shape)      # [4, 5]
print(len(a))       # 4 (size of first dimension)
print(a[0, 2])      # single element, as a Python float

# NumPy-style slicing returns zero-copy views
sub = a[1:3, 2:4]
print(sub.shape)          # [2, 2]
print(sub.is_contiguous())  # False (it's a strided view)
print(sub.to_numpy())       # materializes the view as a real NumPy array

# Matrix multiplication
b = aakaar.rand((5, 3), device="cpu", seed=42)
c = aakaar.matmul(a, b)
print(c.shape)  # [4, 3]

# On a CUDA-enabled build with a GPU available:
x = aakaar.rand((1024, 1024), device="cuda")
y = aakaar.rand((1024, 1024), device="cuda")
z = aakaar.matmul(x, y)   # runs via cuBLAS, stays on-device
result = z.to_numpy()     # only now does data move to host

Notes

  • matmul currently supports 2D tensors only, and both operands must be on the same device.
  • Slicing with a non-unit step on CUDA tensors is correct but not yet memory-optimal for very large tensors — to_numpy() on such a view copies the full spanned region rather than just the selected elements.
  • This is an actively developed project; APIs may change between minor versions.

Download files

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

Source Distribution

aakaar-0.1.6.tar.gz (9.8 kB view details)

Uploaded Source

Built Distributions

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

aakaar-0.1.6-cp314-cp314-win_amd64.whl (120.2 kB view details)

Uploaded CPython 3.14Windows x86-64

aakaar-0.1.6-cp313-cp313-win_amd64.whl (117.1 kB view details)

Uploaded CPython 3.13Windows x86-64

aakaar-0.1.6-cp312-cp312-win_amd64.whl (117.1 kB view details)

Uploaded CPython 3.12Windows x86-64

aakaar-0.1.6-cp311-cp311-win_amd64.whl (115.5 kB view details)

Uploaded CPython 3.11Windows x86-64

aakaar-0.1.6-cp310-cp310-win_amd64.whl (114.4 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file aakaar-0.1.6.tar.gz.

File metadata

  • Download URL: aakaar-0.1.6.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6.tar.gz
Algorithm Hash digest
SHA256 12acdec0be0a48c32fbe2b1a2dfb1dedfdf002bfb5b0aa8599994c6ac95b0978
MD5 ee33dbe569168bd6ebd683a3f7be0ec8
BLAKE2b-256 a62478a806494112c3fdad28fb906790cf41e854f8a507acb2d1b66df70191cb

See more details on using hashes here.

File details

Details for the file aakaar-0.1.6-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: aakaar-0.1.6-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 120.2 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d35886f759f04a46b0ac9d7ce041a8b2dbf0d0a86b7f54f1813f210a8117861a
MD5 6b8d9af11d140866035d75fa3bbc36eb
BLAKE2b-256 45984815e39b391d271b46415318d0830023ae81b6aaedcc5248803102b9f93e

See more details on using hashes here.

File details

Details for the file aakaar-0.1.6-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: aakaar-0.1.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 117.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3e070f1cff04d49db74334985316b804c960b9e9f02361880e8f5b6378970419
MD5 a32e9bf4002f04dd6c4ea96817fb3433
BLAKE2b-256 c83a6c37cc9f554905484da9315d63102e672298cdd7c1c0c296285e03e7ac50

See more details on using hashes here.

File details

Details for the file aakaar-0.1.6-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: aakaar-0.1.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 117.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0349ab0affd7fd98fe55db2027a5b838a82a3033cf4cc078d65a043c0fdfee24
MD5 27a29da84dd7fbe6887c019302e349ff
BLAKE2b-256 4d8fb6694a52d798fd48ff17aefba2fb967743a90ed41ceb0d778d340cddd468

See more details on using hashes here.

File details

Details for the file aakaar-0.1.6-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: aakaar-0.1.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 115.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a39ead773a01b819d82c991c32dbec979fe429b07380147f99edf4ba9c7893f1
MD5 aaff23296d0fa92360e49a9144f02f4f
BLAKE2b-256 f19b8706d8d9449e454525777cebaf88765cc411f58976da90f1b03c2872762e

See more details on using hashes here.

File details

Details for the file aakaar-0.1.6-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: aakaar-0.1.6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 114.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for aakaar-0.1.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d96c977f83dff3deeec6180734b72fcc0f198f5a0b57426356be6af59ac2715f
MD5 24ff88e63abb879864e4891657db9544
BLAKE2b-256 8c7df650bf38b60c880b17c575f2f7d2fd94c0e00874e080b00eb6cdff9d73ab

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