Skip to main content

Python SDK for Axicor Spiking Neural Network Engine — Zero-Copy UDP Data Plane

Project description

Axicor Python SDK

Official Python interface for the Axicor Spiking Neural Network (SNN) Engine.

CRITICAL: THE 10ms BUDGET & ZERO-GARBAGE LAW

Axicor operates on a hard real-time BSP (Barrier Synchronization) cycle. You have exactly 10ms to complete your observation-action loop.

You MUST NOT perform any heap allocations (creating new numpy arrays, tuples, or large objects) inside the hot loop. Triggering the Python Garbage Collector (GC) will cause a micro-stutter, resulting in dropped UDP packets and Biological Amnesia (loss of brain state).

Zero-Garbage Production Pattern

The Correct Way (Zero-Allocation)

import numpy as np
from axicor.encoders import PopulationEncoder

# 1. PRE-ALLOCATE everything outside the loop. Reused every tick.
encoder = PopulationEncoder(variables_count=4, neurons_per_var=16, batch_size=20)
# ✅ Pre-allocate buffer once
frame_buf = np.zeros(encoder.total_bytes + 20, dtype=np.uint8)

while True:
    obs = env.get_observation()
    # 2. ✅ encode_into() writes directly into the pre-allocated buffer
    # Offset=20 leaves space for the C-ABI ExternalIoHeader
    encoder.encode_into(obs, frame_buf, offset=20)
    
    # 3. Send via zero-copy UDP
    client.send(frame_buf)

The Wrong Way (Triggers GC)

while True:
    obs = env.get_observation()
    # ❌ WRONG: This creates a NEW array object every tick.
    # This triggers malloc() and will eventually force a GC pause.
    frame = encoder.encode(obs)
    client.send(frame)

Installation

pip install axicor-client

License

GPL-3.0-or-later

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

axicor_client-0.0.1.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

axicor_client-0.0.1-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file axicor_client-0.0.1.tar.gz.

File metadata

  • Download URL: axicor_client-0.0.1.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for axicor_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b4a11d9e2dfd8b2672829689384af0136e91a27eb5f298bc80538150c7f4f3ab
MD5 029c195574468e40f839b1c55e03fe65
BLAKE2b-256 16ed4a001189fd998668a9bd49f03cee9884df152f65c71011c78ea79444ff1f

See more details on using hashes here.

File details

Details for the file axicor_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: axicor_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for axicor_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47ada8e3572bff47e6f709e038aef6b2824d6b8906ab9563b97205f00dd8fee3
MD5 b3eaa77d70ca82fd63f2069c7f564249
BLAKE2b-256 3d0d69124070695a5c82a30ee0a6483e3cf1fbca280c78e79731516cea3fb824

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