Skip to main content

Lightweight, zero-dependency Python-to-Metal GPGPU advection engine & local transformer

Project description

⚜️ Sovereign-Metal

Mac OS Metal License: MIT

A zero-dependency, high-throughput Python-to-Metal GPGPU advection engine and local transformer pipeline. Program custom MSL (Metal Shading Language) kernels directly from Python with zero-copy unified memory alignment and zero PCIe bus latency.


🔱 Core Features

  • Zero-Copy Unified Memory: Directly maps NumPy arrays into shared CPU/GPU buffers (MTLResourceStorageModeShared), completely bypassing PCIe transfer bottlenecks.
  • Branchless Toroidal Boundary Wrapping: Implements hardware-level bitwise wrapping (x - 1u) & (dim - 1u) inside MSL shaders, avoiding thread divergence and division stalls on integrated Apple/Intel GPUs.
  • Zero-Latency Reduction Tree: Runs a dedicated Shannon entropy, localization intensity, and energy proxy reduction kernel entirely in threadgroup scratchpad memory.
  • Standalone GPGPU Transformer: Runs FP16 BERT-style embeddings (all-MiniLM-L6-v2) locally on Metal with strict GPGPU acceleration.

📐 Mathematical Framework

Toroidal Fluid Dynamics (Soliton Advection)

The advection advects a continuous scalar field $S$ through a density field $\rho$ on a conjoined toroidal manifold:

$$\frac{\partial S}{\partial t} = -\nu \nabla^2 S - \alpha (\nabla \rho) \cdot \nabla S + \kappa |S|^2 S$$

Where:

  • $\nu$ represents the dissipation/damping coefficient.
  • $\alpha$ is the advection coupling strength.
  • $\kappa$ is the non-linear soliton crystallization rate.

🚀 Quick Start

1. Installation

Clone the repository and install the dependencies:

cd sovereign-metal
pip install -e .

2. Run Semantic Embeddings Demo

Verify the local GPGPU transformer inference:

python examples/local_embeddings.py

3. Run Toroidal Advection Benchmark

Execute the soliton advection simulation and watch the real-time crystallization metrics stream from the GPU:

python examples/benchmark_advection.py

⚜️ License

MIT License. Crafted for the GPGPU developer community.

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

sovereign_metal-1.0.1.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

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

sovereign_metal-1.0.1-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

File details

Details for the file sovereign_metal-1.0.1.tar.gz.

File metadata

  • Download URL: sovereign_metal-1.0.1.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sovereign_metal-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9fe90ce1f9ee60035b3cf707e0d80ea23641e912224e4f7776e0ec02f3a4263d
MD5 f84b586d6e2710094b0a40015374e5d4
BLAKE2b-256 c0da2a8714e10ea1556becaac2275e8ad4ceef52442205a4937a9551a786596b

See more details on using hashes here.

File details

Details for the file sovereign_metal-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sovereign_metal-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d852d13a9580255b216f1313584686eb7a4978fee36f109f2f27cf4a7534073b
MD5 9f000271a345a2bf693aa8712f1799ae
BLAKE2b-256 4c5328a0400d850c823cfcc234dfa1a3fb64a8516cf345915a86b40783123789

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