Skip to content

Commit 1f45c62

Browse files
committed
bench: add shared-inputs path; Rust/C/C++ support --graph-file/--sources-file; fix C dist sizing; expand .gitignore; docs: languages list
0 parents  commit 1f45c62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5845
-0
lines changed

.github/workflows/bench.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: bench
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
pull_request: {}
8+
9+
jobs:
10+
smoke:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
- name: Build and test (Rust)
16+
run: |
17+
cargo build -p bmssp
18+
cargo test -p bmssp --all-features -- --nocapture
19+
- name: Install minimal deps
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y build-essential default-jdk elixir erlang
23+
python3 -m pip install --user -r bench/requirements.txt || true
24+
- name: Quick smoke
25+
run: |
26+
python3 bench/runner.py --quick --smoke --timeout-seconds 20 --out results-dev
27+
- name: Upload smoke results
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: results-dev
31+
path: |
32+
results-dev
33+
34+
rust-bench:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
39+
- name: Cargo test (unit)
40+
run: |
41+
cargo test -p bmssp --verbose
42+
- name: Install Crystal
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y curl gnupg build-essential
46+
curl -fsSL https://dist.crystal-lang.org/apt/setup.sh | sudo bash
47+
sudo apt-get install -y crystal shards
48+
- name: Install JDK/Kotlin, Elixir, Erlang (with SDKMAN fallback)
49+
run: |
50+
set -euxo pipefail
51+
sudo apt-get update
52+
sudo apt-get install -y default-jdk elixir erlang || true
53+
if ! command -v java >/dev/null; then sudo apt-get install -y default-jdk || true; fi
54+
if ! command -v kotlinc >/dev/null; then
55+
# SDKMAN fallback for Kotlin
56+
curl -s "https://get.sdkman.io" | bash
57+
source "$HOME/.sdkman/bin/sdkman-init.sh"
58+
sdk install java 21.0.3-tem || true
59+
sdk install kotlin 2.0.20 || true
60+
kotlinc -version || true
61+
fi
62+
- name: Install Nim
63+
uses: iffy/install-nim@v5
64+
with:
65+
version: stable
66+
- name: Cache cargo
67+
uses: actions/cache@v4
68+
with:
69+
path: |
70+
~/.cargo/registry
71+
~/.cargo/git
72+
target
73+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
74+
- name: Run bench runner (release)
75+
run: |
76+
python3 -m pip install --user -r bench/requirements.txt || true
77+
python3 bench/runner.py --release --jobs 2 --timeout-seconds 120 --out results
78+
- name: Upload results
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: results
82+
path: results

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
target/
2+
results/
3+
results-*/
4+
results-dev*/
5+
**/*.svg
6+
**/*.png
7+
.idea/
8+
.vscode/
9+
**/__pycache__/
10+
*.pyc
11+
*.pyo
12+
*.pyd
13+
venv/
14+
.venv/
15+
erl_crash.dump
16+
impls/c/bmssp_c
17+
impls/cpp/bmssp_cpp
18+
impls/crystal/bin/
19+
impls/zig/zig-out/
20+
impls/zig/zig-cache/
21+
impls/nim/bmssp_nim
22+
impls/nim/bmssp_nim_dbg
23+
impls/kotlin/*.jar
24+
impls/erlang/*.beam
25+
26+
# OS cruft
27+
.DS_Store
28+
Thumbs.db

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Contributing
2+
3+
Thanks for helping improve bmssp-benchmark-game! This project compares bounded multi-source SSSP across languages in a reproducible way.
4+
5+
## Adding a new language
6+
- Create `impls/<lang>/` with a build script (Makefile, shards, etc.).
7+
- Implement the CLI contract:
8+
- Flags: `--graph grid|er|ba`, `--rows/--cols` or `--n/--p`, `--k`, `--B`, `--seed`, `--trials`, `--maxw`, `--json`.
9+
- Output per trial: one JSON line with keys: impl, lang, graph, n, m, k, B, seed, time_ns, popped, edges_scanned, heap_pushes, B_prime, mem_bytes.
10+
- Use push-duplicates, skip-stale; halt when next pop >= B; track B'.
11+
- Keep single-threaded and exclude graph generation from timed region.
12+
- Add build + run hooks to `bench/runner.py` following existing implementations.
13+
14+
## Verification
15+
- Ensure results match Rust’s metrics for the same seed and params on tiny graphs (popped, edges_scanned, B_prime).
16+
- Run `python3 bench/runner.py --out results` locally.
17+
18+
## Code style
19+
- Favor simplicity and portability over micro-optimizations. No global state.
20+
- Add comments on any non-obvious choices.

0 commit comments

Comments
 (0)