Skip to main content

SIMD-accelerated frame stacking. Batched accumulation with reduced memory traffic.

Project description

eastack

SIMD-accelerated frame stacking powered by Ea kernels.

Stack N noisy exposures into a clean result. Signal reinforces, noise cancels by sqrt(N). Useful for astronomy, microscopy, video denoising, or any workflow that averages multiple frames.

Install

pip install eastack

Pre-built wheels include compiled SIMD kernels for Linux x86_64, Linux aarch64, and Windows x86_64.

Usage

import numpy as np
from eastack import stack_mean

# Stack 16 noisy frames into a clean mean
frames = [np.random.rand(1024, 1024).astype(np.float32) for _ in range(16)]
result = stack_mean(frames)

# Also accepts 3D arrays (N, H, W)
data = np.random.rand(16, 1024, 1024).astype(np.float32)
result = stack_mean(data)

API

Function Description
stack_mean(frames) Stack and compute mean. Returns f32 array.
stack(frames) Accumulate without dividing. Returns sum.
frame_stats(data) Single-pass (min, max, sum) of a float32 array.

Low-level kernel access:

Function Description
accumulate_f32x8(acc, frame) acc += frame using SIMD
accumulate_batch4_f32x8(acc, f0, f1, f2, f3) 4 frames in one pass
accumulate_batch8_f32x8(acc, f0..f7) 8 frames in one pass
scale_f32x8(data, out, factor) out = data * factor using SIMD

How it works

Batched accumulation reduces memory traffic by processing multiple frames per pass over the accumulator:

  • Single-frame: acc += frame — 3N memory transactions per element (read acc, read frame, write acc) repeated N times
  • Batched (K=8): acc += f0 + f1 + ... + f7 — one acc read/write per 8 frames

The stack() function automatically dispatches: batch8 first, then batch4 for remainder, then singles.

Performance

On 4096x4096 frames (64 MB accumulator, single-threaded):

NumPy streaming (np.add loop) : 119 ms
Ea single-frame (same loop)   : 110 ms
Ea batched (8 frames/pass)    :  68 ms  — 1.76x faster

The speedup grows with frame size because the accumulator exceeds L3 cache — reducing acc traffic has maximum impact in DRAM.

Building from source

EA_BIN=./ea ./build_kernels.sh
pip install -e .

Requirements

  • Python 3.9+
  • NumPy

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.

eastack-0.1.0-py3-none-win_amd64.whl (7.6 kB view details)

Uploaded Python 3Windows x86-64

eastack-0.1.0-py3-none-manylinux_2_17_x86_64.whl (8.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

eastack-0.1.0-py3-none-manylinux_2_17_aarch64.whl (9.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

File details

Details for the file eastack-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: eastack-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 7.6 kB
  • 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 eastack-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 be1f9f4a20d9e7c33363f7e0b22518520a06cb92468bbb21e97f2971a8486b0d
MD5 aa2de7bd469aec74795923a65fac342f
BLAKE2b-256 db2ee842a0a3ac1dedd52978691e5a292117df278c0e2969fb2ecca3181327a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for eastack-0.1.0-py3-none-win_amd64.whl:

Publisher: publish.yml on petlukk/eastack

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

File details

Details for the file eastack-0.1.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for eastack-0.1.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3f6d4eb7d40387b2af49e0ba1fcee91c6e3dae88fb135403d974e03874f1c6b9
MD5 59d731af7d893c3f72913ec0984b2118
BLAKE2b-256 e617d9015c02a835e5958d13e2adb09b34e62b571e75af726257c747ef5c8569

See more details on using hashes here.

Provenance

The following attestation bundles were made for eastack-0.1.0-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish.yml on petlukk/eastack

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

File details

Details for the file eastack-0.1.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for eastack-0.1.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 253972f130f25527ed9a4b8caa5434327afb18d6b130052567821163bea620df
MD5 e4aa70a2aac7e85533fb97d73d81f2fe
BLAKE2b-256 529f27b189b17c106a9decbf9e6a87addf6d7cc588612f60f13c0920a738b699

See more details on using hashes here.

Provenance

The following attestation bundles were made for eastack-0.1.0-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish.yml on petlukk/eastack

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