|
| 1 | +# arena_interface |
| 2 | + |
| 3 | +`arena_interface` is a small Python package and CLI for controlling the Reiser |
| 4 | +Lab `ArenaController` firmware over serial or Ethernet and for collecting |
| 5 | +host-side benchmark results that can be compared with firmware-side `PERF_*` QS |
| 6 | +records. |
| 7 | + |
| 8 | +This repository uses a single `pyproject.toml` as the source of truth for |
| 9 | +package metadata, development tooling, and Pixi tasks. The importable package |
| 10 | +lives under `src/`, which helps catch packaging mistakes earlier than a flat |
| 11 | +layout. |
| 12 | + |
| 13 | +## Repository layout |
| 14 | + |
| 15 | +- `src/arena_interface/`: importable package and CLI |
| 16 | +- `scripts/`: developer helper scripts, including benchmark matrix helpers |
| 17 | +- `tests/`: lightweight smoke tests that do not require hardware |
| 18 | +- `patterns/`: small example pattern files for streaming tests |
| 19 | +- `pyproject.toml`: packaging metadata, tool configuration, and Pixi manifest |
| 20 | + |
| 21 | +## Quick start with Pixi |
| 22 | + |
| 23 | +Install Pixi, then from the repository root run: |
| 24 | + |
| 25 | +```sh |
| 26 | +pixi install |
| 27 | +pixi run help |
| 28 | +``` |
| 29 | + |
| 30 | +You can also run ad-hoc Python inside the managed environment: |
| 31 | + |
| 32 | +```sh |
| 33 | +pixi run python -c "from arena_interface import ArenaInterface; print(ArenaInterface)" |
| 34 | +``` |
| 35 | + |
| 36 | +## Quick smoke tests |
| 37 | + |
| 38 | +Before running longer benchmarks, use the `all-on` and `all-off` tasks to make |
| 39 | +sure the host can talk to the arena and that the display is responding. |
| 40 | + |
| 41 | +For Ethernet: |
| 42 | + |
| 43 | +```sh |
| 44 | +export ARENA_ETH_IP=192.168.10.104 |
| 45 | +pixi run all-on |
| 46 | +pixi run all-off |
| 47 | +``` |
| 48 | + |
| 49 | +For serial: |
| 50 | + |
| 51 | +```sh |
| 52 | +export ARENA_SERIAL_PORT=/dev/ttyACM0 |
| 53 | +pixi run all-on |
| 54 | +pixi run all-off |
| 55 | +``` |
| 56 | + |
| 57 | +On Windows PowerShell, set the transport variable like this before running the |
| 58 | +same Pixi tasks: |
| 59 | + |
| 60 | +```powershell |
| 61 | +$env:ARENA_ETH_IP = "192.168.10.104" |
| 62 | +# or |
| 63 | +$env:ARENA_SERIAL_PORT = "COM3" |
| 64 | +pixi run all-on |
| 65 | +pixi run all-off |
| 66 | +``` |
| 67 | + |
| 68 | +These tasks are a quick sanity check for: |
| 69 | + |
| 70 | +- transport configuration |
| 71 | +- basic command/response communication |
| 72 | +- visible LED output |
| 73 | + |
| 74 | +If `pixi run all-on` succeeds but a benchmark later fails, that usually means |
| 75 | +the basic connection is fine and the problem is in benchmark configuration, |
| 76 | +streaming, or timing rather than simple connectivity. |
| 77 | + |
| 78 | +## Benchmark workflow |
| 79 | + |
| 80 | +The CLI still supports direct invocation, but the normal developer workflow is |
| 81 | +now through `pixi run` tasks. |
| 82 | + |
| 83 | +Set the transport once via environment variables or pass the flags explicitly. |
| 84 | +For Ethernet benchmarks, the simplest setup is: |
| 85 | + |
| 86 | +```sh |
| 87 | +export ARENA_ETH_IP=192.168.10.104 |
| 88 | +pixi run bench -- --stream-path patterns/pat0004.pat --json-out bench_results.jsonl |
| 89 | +``` |
| 90 | + |
| 91 | +Useful pre-defined tasks: |
| 92 | + |
| 93 | +- `pixi run all-on`: turn all LEDs on as a communication sanity check |
| 94 | +- `pixi run all-off`: turn all LEDs off as a communication sanity check |
| 95 | +- `pixi run bench`: default host benchmark suite |
| 96 | +- `pixi run bench-persistent`: force persistent TCP sockets for small-command RTT |
| 97 | +- `pixi run bench-new-connection`: open a new TCP connection per command |
| 98 | +- `pixi run bench-no-quickack`: disable Linux `TCP_QUICKACK` but keep `TCP_NODELAY` |
| 99 | +- `pixi run bench-no-nodelay`: disable `TCP_NODELAY` but keep `TCP_QUICKACK` requested |
| 100 | +- `pixi run bench-no-latency-tuning`: disable both socket latency knobs |
| 101 | +- `pixi run bench-socket-matrix -- --json-out bench_matrix.jsonl`: run a small comparison matrix across socket-option variants |
| 102 | + |
| 103 | +Extra arguments after the task are forwarded to the CLI or script, so you can |
| 104 | +still customize labels, durations, rates, and pattern paths. |
| 105 | + |
| 106 | +## Socket latency tuning |
| 107 | + |
| 108 | +The host code exposes both `TCP_NODELAY` and `TCP_QUICKACK` as explicit options. |
| 109 | +That makes it easy to compare: |
| 110 | + |
| 111 | +- Linux Python with both knobs enabled |
| 112 | +- Linux Python with only one enabled |
| 113 | +- platforms where `TCP_QUICKACK` is unavailable or ignored |
| 114 | + |
| 115 | +The benchmark metadata records which socket settings were requested and whether |
| 116 | +`TCP_QUICKACK` was supported on the current host, so later analysis can compare |
| 117 | +runs fairly. |
| 118 | + |
| 119 | +## Development tasks |
| 120 | + |
| 121 | +```sh |
| 122 | +pixi run format |
| 123 | +pixi run lint |
| 124 | +pixi run test |
| 125 | +pixi run check |
| 126 | +pixi run build |
| 127 | +pixi run archive |
| 128 | +``` |
0 commit comments