Eä compute kernel compiler for Python — write SIMD kernels, call from NumPy
Project description
ea-compiler
Python package wrapping the Eä 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
- Bundles a pre-built
eacompiler binary (no Rust or LLVM needed) ea.load()invokes the compiler via subprocess to produce a.so/.dll- Parses the generated
.ea.jsonmetadata to build ctypes bindings at runtime - Length parameters (
n,len,count, etc.) are auto-filled from array sizes - Output parameters with
[cap: ...]annotations are auto-allocated and returned - Results are cached per CPU target and compiler version
Documentation
Full documentation: petlukk.github.io/eacompute
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10bf5a000746ef33d31d43b0dfae7373b215f533f08af84bc39169281889ca86
|
|
| MD5 |
df250b57b988f5eef60a07ff3811624e
|
|
| BLAKE2b-256 |
2694911453acc1efd953d9cb06061bc51a98c3e37890206446c9e80dea135bfd
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ea_compiler-1.10.0-py3-none-win_amd64.whl -
Subject digest:
10bf5a000746ef33d31d43b0dfae7373b215f533f08af84bc39169281889ca86 - Sigstore transparency entry: 1134599477
- Sigstore integration time:
-
Permalink:
petlukk/ea-compiler@095ebe777be2a478b3e844f6e091f99747bc3742 -
Branch / Tag:
refs/tags/ea-compiler-v1.10.0 - Owner: https://github.com/petlukk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@095ebe777be2a478b3e844f6e091f99747bc3742 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 22.1 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ba87558bf2f6786b57961f485a775eab0d3e29b10b70d97b0bbd1641caa0948
|
|
| MD5 |
67cb63444f961e224361b17ae4e3df63
|
|
| BLAKE2b-256 |
2ba313e70c28bf97814995b2c6a708ece133e705b1db16f12c1f388ec7756a95
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ea_compiler-1.10.0-py3-none-manylinux_2_17_x86_64.whl -
Subject digest:
4ba87558bf2f6786b57961f485a775eab0d3e29b10b70d97b0bbd1641caa0948 - Sigstore transparency entry: 1134599401
- Sigstore integration time:
-
Permalink:
petlukk/ea-compiler@095ebe777be2a478b3e844f6e091f99747bc3742 -
Branch / Tag:
refs/tags/ea-compiler-v1.10.0 - Owner: https://github.com/petlukk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@095ebe777be2a478b3e844f6e091f99747bc3742 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 18.5 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9563832b99515e95f5c1960c0376ad7bc134809461941286dfe15e0f46b4ffd
|
|
| MD5 |
645d2f09b5713bc419911d3b886423e5
|
|
| BLAKE2b-256 |
2d07648ccb4283264ecdf5d8d5b133e66834b8fa37c88b153800aa5322a41cce
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ea_compiler-1.10.0-py3-none-manylinux_2_17_aarch64.whl -
Subject digest:
d9563832b99515e95f5c1960c0376ad7bc134809461941286dfe15e0f46b4ffd - Sigstore transparency entry: 1134599573
- Sigstore integration time:
-
Permalink:
petlukk/ea-compiler@095ebe777be2a478b3e844f6e091f99747bc3742 -
Branch / Tag:
refs/tags/ea-compiler-v1.10.0 - Owner: https://github.com/petlukk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@095ebe777be2a478b3e844f6e091f99747bc3742 -
Trigger Event:
push
-
Statement type: