Skip to main content

Eä compute kernel compiler for Python — write SIMD kernels, call from NumPy

Project description

ea-compiler

Python package wrapping the compute kernel compiler. Write .ea kernel files, compile to native SIMD code, call from Python with NumPy arrays. No C toolchain, no Cython, no JIT warmup.

Install

pip install ea-compiler

Works on Linux x86_64, Linux aarch64, and Windows x86_64.

Quick start

Write a kernel (scale.ea):

export func scale(src: *f32, dst: *mut f32, factor: f32, n: i32) {
    let s: f32x8 = splat(factor)
    let mut i: i32 = 0
    while i < n {
        let v: f32x8 = load(src, i)
        store(dst, i, v .* s)
        i = i + 8
    }
}

Call it from Python:

import ea
import numpy as np

kernel = ea.load("scale.ea")

src = np.random.randn(1_000_000).astype(np.float32)
dst = np.empty_like(src)
kernel.scale(src, dst, factor=2.0)

ea.load() compiles the kernel to a native shared library, caches it in __eacache__/, and returns a callable object with ctypes bindings generated from the function signature. Subsequent calls use the cache.

API

import ea

# Compile, cache, and load — returns callable kernel module
kernel = ea.load("kernel.ea", target="native", opt_level=3)

# Compile without caching — returns Path to .so/.dll
ea.compile("kernel.ea")

# Clear cached compilations
ea.clear_cache()

# Version info
ea.__version__          # package version
ea.compiler_version()   # bundled ea binary version

How it works

  1. Bundles a pre-built ea compiler binary (no Rust or LLVM needed)
  2. ea.load() invokes the compiler via subprocess to produce a .so/.dll
  3. Parses the generated .ea.json metadata to build ctypes bindings at runtime
  4. Length parameters (n, len, count, etc.) are auto-filled from array sizes
  5. Output parameters with [cap: ...] annotations are auto-allocated and returned
  6. Results are cached per CPU target and compiler version

Documentation

Full documentation: petlukk.github.io/eacompute

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ea_compiler-1.10.0-py3-none-win_amd64.whl (17.7 MB view details)

Uploaded Python 3Windows x86-64

ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl (22.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl (18.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

File details

Details for the file ea_compiler-1.10.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: ea_compiler-1.10.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 17.7 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ea_compiler-1.10.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 10bf5a000746ef33d31d43b0dfae7373b215f533f08af84bc39169281889ca86
MD5 df250b57b988f5eef60a07ff3811624e
BLAKE2b-256 2694911453acc1efd953d9cb06061bc51a98c3e37890206446c9e80dea135bfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ea_compiler-1.10.0-py3-none-win_amd64.whl:

Publisher: publish.yml on petlukk/ea-compiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4ba87558bf2f6786b57961f485a775eab0d3e29b10b70d97b0bbd1641caa0948
MD5 67cb63444f961e224361b17ae4e3df63
BLAKE2b-256 2ba313e70c28bf97814995b2c6a708ece133e705b1db16f12c1f388ec7756a95

See more details on using hashes here.

Provenance

The following attestation bundles were made for ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish.yml on petlukk/ea-compiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 d9563832b99515e95f5c1960c0376ad7bc134809461941286dfe15e0f46b4ffd
MD5 645d2f09b5713bc419911d3b886423e5
BLAKE2b-256 2d07648ccb4283264ecdf5d8d5b133e66834b8fa37c88b153800aa5322a41cce

See more details on using hashes here.

Provenance

The following attestation bundles were made for ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish.yml on petlukk/ea-compiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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