Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion interactive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ columnar = { workspace = true }
# The columnar kernels for the interpreted backend, pinned by git rev.
corgi = { git = "https://github.com/frankmcsherry/WIP", rev = "de0f2ac91d31ac63641035e5a5bb1b5640fe9424", features = ["serde"] }
differential-dataflow = { workspace = true }
mimalloc = "0.1.48"
serde = { version = "1.0", features = ["derive"] }
smallvec = "1.15.1"
timely = { workspace = true }
Expand Down
13 changes: 11 additions & 2 deletions interactive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,18 @@ The flow moves through four steps:
4. The `examples/` directory contains back-ends that execute programs.

The `examples/programs/` directory contains example programs, intentionally simple at the moment.
You can run any of them with one of the example harnesses, for example
The one executable is the server (the `ddir-server` crate in `server/`, documented in
`server/README.md`; the session scripts in `examples/server/` show it at work); a program runs by
loading it, feeding its inputs, and closing epochs. For example, on a random graph of 100 nodes and
200 edges, 10 of which change each epoch, for 100 epochs, on four workers of the Corgi backend:
```
cargo run --release --example ddir_vec -- ./examples/programs/reach.ddp 2 100 200 1 100
cd interactive
printf 'load reach from examples/programs/reach.ddp
feed reach 0 from random:nodes=100,edges=200,churn=10
feed reach 1 0
tick 100
exit
' | DDIR_BACKEND=corgi DDIR_WORKERS=4 cargo run --release -p ddir-server
```

More generally, you can run
Expand Down
16 changes: 8 additions & 8 deletions interactive/examples/aoc2023/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ mixed-arity inputs.

## Run

cargo build --release --example ddir
./run.sh # every part on the vec backend vs expected.txt; nonzero exit on any mismatch
cargo build --release -p ddir-server
./run.sh # every part on the vec backend vs expected.txt; nonzero exit on any mismatch
./run.sh corgi # the same through the Corgi columnar backend

`run.sh` first runs `transcribe.py` (python3) to regenerate `gen/`, then
runs each part as `EDGES_FILE=gen/<input> ddir --backend=vec
dayNN/partN.ddp <arity> 10 0 1 0`; the answer is the `Int` on the
`[partN]` inspect line.
runs each part as one server session piped into `ddir_server` — `load` the
program from its file, `feed … from` the fact file into input 0, `tick` — and
reads the answer off the `[partN]` inspect line.

`run.sh` asserts the **vec** backend only; corgi currently disagrees or
crashes on 4 of these parts (known open issues, minimized separately) and
is not asserted yet.
Both backends pass all 33 parts. Corgi needs day05's arity-padded inputs
(`run.sh corgi` transcribes with `--pad`).

## Verdicts

Expand Down
18 changes: 12 additions & 6 deletions interactive/examples/aoc2023/run.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/bin/sh
# Run every AoC 2023 program on the vec backend and check the answers.
# Usage: ./run.sh [path/to/ddir] (build with: cargo build --release --example ddir)
# Run every AoC 2023 program through the DDIR server and check the answers.
# Usage: ./run.sh [vec|corgi] [path/to/ddir_server]
# (build with: cargo build --release -p ddir-server)
cd "$(dirname "$0")" || exit 1
DDIR=${1:-../../../target/release/examples/ddir}
python3 transcribe.py || exit 1 # dense dayNN/input.txt -> gen/dayNN/ fact files
BACKEND=${1:-vec}
SERVER=${2:-../../../target/release/ddir_server}
PAD=; [ "$BACKEND" = corgi ] && PAD=--pad # corgi needs day05's uniform-arity copies
python3 transcribe.py $PAD || exit 1 # dense dayNN/input.txt -> gen/dayNN/ fact files
fail=0
while read -r day part expected; do
case "$day" in ''|'#'*) continue;; esac
dir=day$day
inp=gen/$dir/input.txt
[ -f "gen/$dir/input$part.txt" ] && inp=gen/$dir/input$part.txt # day05/day15: per-part inputs
arity=$(head -1 "$inp" | awk '{print NF}')
got=$(EDGES_FILE=$inp "$DDIR" --backend=vec "$dir/part$part.ddp" "$arity" 10 0 1 0 2>&1 \
[ -n "$PAD" ] && [ -f "gen/$dir/input${part}p.txt" ] && inp=gen/$dir/input${part}p.txt
# One session per part: load the program, feed its input from the fact
# file, close the epoch. The answer is the `Int` on the `[partN]` inspect line.
got=$(printf 'load p from %s\nfeed p 0 from %s\ntick\nexit\n' "$dir/part$part.ddp" "$inp" \
| DDIR_BACKEND="$BACKEND" "$SERVER" 2>&1 \
| sed -n "s/.*\\[part$part\\].*Int(\\(-\\{0,1\\}[0-9]*\\)).*/\\1/p")
if [ "$got" = "$expected" ]; then
echo "day$day part$part: ok ($got)"
Expand Down
248 changes: 0 additions & 248 deletions interactive/examples/ddir.rs

This file was deleted.

Loading
Loading