Skip to main content

High-performance tensor library with NumPy semantics, accelerated on Metal, CUDA, WebGPU, and CPU.

Project description

ACTx (Accelerated, Computegraph, Tensor, Execution)

PyPI version PyPI downloads Build Codecov License

Platform Wheel code style Python version

"What I cannot create, I do not understand." - Richard Feynman

Driven by this philosophy, this high-performance tensor library was built as a hands-on learning project. It leverages Metal for GPU acceleration, implements dynamic compute graphs for automatic differentiation (autograd), and provides Python bindings for ease of use in machine learning and scientific computing.

Note: While capable of basic tensor operations and gradient computation, this project is intended primarily for educational purposes and is not intended for production-level model building.

Features

  • GPU Acceleration: Utilizes Metal for efficient tensor computation on macOS devices.
  • Dynamic Compute Graphs: Implements dynamic computation graphs for automatic differentiation, similar to autograd, enabling gradient computation for machine learning tasks.
  • Python Bindings: Provides Python bindings for seamless integration with Python-based workflows.
  • High Performance: Optimized for both CPU and GPU execution, ensuring maximum performance across Metal enabled devices.
  • Educational Focus: Aimed at helping users understand the underlying concepts of tensor operations, autograd, and GPU acceleration.

Requirements

  • macOS 10.15+ or iOS 13+ with Metal support
  • Xcode 12+ with Command Line Tools
  • Python 3.x (for Python bindings)
  • CMake 3.x or higher (for building the project)

Installation

From Source

  1. Clone the repository:

    git clone https://github.com/arjunmnath/ACTx.git
    cd ACTx
    
  2. Build the C++/Objective-C++ library:

    Debug build

    cmake --preset debug
    cmake --build build -- -j$(nproc)
    

    Release build

    cmake --preset release
    cmake --build build -- -j$(nproc)
    

    Test build

    cmake --preset test
    cmake --build build -- -j$(nproc)
    

    Run Tests

    ctest --parallel $(nproc) --progress --test-dir build --output-on-failure
    
  3. Install Python bindings:

    pip install .
    

From PyPi

pip install actx

🚧 Only on MacOS at present

Usage

C++/Objective-C++ API

#include "actx.h"

int main() {
    Tensor tensor1 = Tensor::random({3, 3});
    Tensor tensor2 = Tensor::random({3, 3});

    // Define a simple computation
    Tensor result = tensor1 * tensor2;

    // Compute gradients
    result.backward();

    // Access the gradients
    Tensor grad = tensor1.grad();
    grad.print();
    return 0;
}

Python API

import actx

# Create tensors
tensor1 = actx.random((3, 3), requires_grad=True)
tensor2 = actx.random((3, 3), requires_grad=True)

# Define a simple computation
result = tensor1 * tensor2

# Compute gradients
result.backward()

# Access the gradients
grad_tensor1 = tensor1.grad
grad_tensor2 = tensor2.grad

print("Gradient of tensor1:\n", grad_tensor1)
print("Gradient of tensor2:\n", grad_tensor2)

Documentation

No documentation understand it yourself 🤷🏻‍♂️

Contributing

Contributions are welcome! Please read our Contributions Guide before submitting a pull request. If you encounter any issues, feel free to open an issue in the repository.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Acknowledgements

  • Metal framework for GPU acceleration
  • Python bindings via c-api
  • Inspired by various tensor libraries such as NumPy and PyTorch, and automatic differentiation systems like autograd.

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

actx-0.1.1.tar.gz (648.8 kB view details)

Uploaded Source

Built Distributions

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

actx-0.1.1-cp312-cp312-macosx_14_0_arm64.whl (224.9 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

actx-0.1.1-cp311-cp311-macosx_14_0_arm64.whl (224.9 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

actx-0.1.1-cp310-cp310-macosx_14_0_arm64.whl (224.9 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

actx-0.1.1-cp39-cp39-macosx_14_0_arm64.whl (224.9 kB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

actx-0.1.1-cp38-cp38-macosx_14_0_arm64.whl (224.7 kB view details)

Uploaded CPython 3.8macOS 14.0+ ARM64

File details

Details for the file actx-0.1.1.tar.gz.

File metadata

  • Download URL: actx-0.1.1.tar.gz
  • Upload date:
  • Size: 648.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for actx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 33d6baf134c16b35cc54dae4fd87ea06e4b18a7d34e37476c598705b53c9462d
MD5 fac865c4177e3fa1478de0dad61d17e4
BLAKE2b-256 e3abfabe7820d93b99ab84c5a3c3f8a250eaa8b171cd297e06b7d42751ee6519

See more details on using hashes here.

File details

Details for the file actx-0.1.1-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for actx-0.1.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c35b231de028bbd9ca5a3d70ceda0334a3b698114be7b2577dbeb4c3ec657dcf
MD5 54872f11f0aa41025636e5e85d23b563
BLAKE2b-256 8c26af202a9f5a73c45e6f87eadd66cc17b46bd13c367a4749813e4630ae4004

See more details on using hashes here.

File details

Details for the file actx-0.1.1-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for actx-0.1.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 6867f661a2c139111408657fa26055e70fd53b7cbb887e22f83f0498cd5766bd
MD5 9abbb8c7c7e88b0bef21ff51c991aaf5
BLAKE2b-256 e2052c97d42cb6a3e70c07a4dfeb88eba0762f13587c8d00dc0da34205880bcb

See more details on using hashes here.

File details

Details for the file actx-0.1.1-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for actx-0.1.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 59e744b1c95176a5572764d4de4bdb8be2326830a999261fc47fa735e4601815
MD5 4fe90c0d1aae5d4cd9f0849d1c1bb23c
BLAKE2b-256 2d8c6ef5d556abba79714ff708bb4dbe8f6684c20e37daccdfd9e711698082fa

See more details on using hashes here.

File details

Details for the file actx-0.1.1-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

  • Download URL: actx-0.1.1-cp39-cp39-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 224.9 kB
  • Tags: CPython 3.9, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for actx-0.1.1-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 58924b905f5937338d9e3182361c6bf3a5529c7d38287d90f3504a03573eb674
MD5 708612bbec47c96ad2c544ff98573d24
BLAKE2b-256 62812308ca660f918b023ecda8136689ebbcaaa6b1a55174c0a40d071d04df53

See more details on using hashes here.

File details

Details for the file actx-0.1.1-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

  • Download URL: actx-0.1.1-cp38-cp38-macosx_14_0_arm64.whl
  • Upload date:
  • Size: 224.7 kB
  • Tags: CPython 3.8, macOS 14.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for actx-0.1.1-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 8b2909f02161115b0aa41cec0297c4035d90be085ac89ca8b80f37b4d38e9522
MD5 18117547158dcf786d1646a0390b7f9e
BLAKE2b-256 5cb70e8f0375494c50a8ef1d405c8f8ad5d9cd70719a95a16c17fd5c261b0fb3

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