|
| 1 | +<!-- |
| 2 | +SPDX-License-Identifier: CC-BY-SA-4.0 |
| 3 | +SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 4 | +--> |
| 5 | + |
| 6 | +[](https://github.com/sponsors/hyperpolymath) |
| 7 | + |
| 8 | +# What Is This? |
| 9 | + |
| 10 | +Chapeliser is a **general-purpose Chapel acceleration framework** that |
| 11 | +lets developers scale single-machine applications to distributed |
| 12 | +clusters without learning Chapel. |
| 13 | + |
| 14 | +You describe your workload in a manifest (`chapeliser.toml`), point |
| 15 | +Chapeliser at your code, and it generates the distributed scaffolding — |
| 16 | +Chapel `coforall` loops, data partitioning, result gathering, and the |
| 17 | +ABI/FFI bridge between your application and the Chapel runtime. |
| 18 | + |
| 19 | +# The Problem |
| 20 | + |
| 21 | +Chapel is one of the most powerful parallel programming languages ever |
| 22 | +built. It can distribute computation across thousands of nodes with |
| 23 | +elegant syntax. But almost nobody uses it because: |
| 24 | + |
| 25 | +1. **Steep learning curve** — you must rewrite your application in |
| 26 | + Chapel or deeply understand its interop model |
| 27 | + |
| 28 | +2. **No incremental adoption path** — it’s all-or-nothing |
| 29 | + |
| 30 | +3. **Build system complexity** — integrating Chapel with existing |
| 31 | + Rust/C/Zig projects is non-trivial |
| 32 | + |
| 33 | +Chapeliser solves all three. |
| 34 | + |
| 35 | +# How It Works |
| 36 | + |
| 37 | + Your application (Rust, C, Zig) |
| 38 | + │ |
| 39 | + ▼ |
| 40 | + chapeliser.toml ──► Chapeliser CLI |
| 41 | + │ │ |
| 42 | + │ ┌───────────┴───────────┐ |
| 43 | + │ │ │ |
| 44 | + ▼ ▼ ▼ |
| 45 | + Idris2 ABI Zig FFI Chapel wrapper |
| 46 | + (formal proof of (C-ABI bridge (coforall + data |
| 47 | + data layout + to Chapel distribution + |
| 48 | + partition safety) runtime) gather/reduce) |
| 49 | + │ │ │ |
| 50 | + └────────┬───────┘ │ |
| 51 | + ▼ │ |
| 52 | + generated/abi/*.h ◄───────────────────┘ |
| 53 | + │ |
| 54 | + ▼ |
| 55 | + Your app, now distributed |
| 56 | + |
| 57 | +## The Manifest |
| 58 | + |
| 59 | +```toml |
| 60 | +[workload] |
| 61 | +name = "my-scanner" |
| 62 | +entry = "src/batch.rs::scan_all" # function to distribute |
| 63 | +partition = "per-item" # split strategy |
| 64 | +gather = "merge" # combine strategy |
| 65 | + |
| 66 | +[data] |
| 67 | +input-type = "Vec<PathBuf>" # what gets distributed |
| 68 | +output-type = "Vec<ScanResult>" # what comes back |
| 69 | +serialization = "bincode" # wire format |
| 70 | + |
| 71 | +[scaling] |
| 72 | +min-nodes = 1 # runs locally if alone |
| 73 | +max-nodes = 256 # scales to cluster |
| 74 | +grain-size = 50 # items per Chapel task |
| 75 | +``` |
| 76 | + |
| 77 | +You write **zero Chapel code**. Chapeliser generates everything. |
| 78 | + |
| 79 | +## Partition Strategies |
| 80 | + |
| 81 | +| Strategy | Description | Best For | |
| 82 | +|------------|------------------------|---------------------------------| |
| 83 | +| `per-item` | One item per task | File scanning, image processing | |
| 84 | +| `chunk` | Fixed-size chunks | Data pipelines, ETL | |
| 85 | +| `adaptive` | Dynamic load balancing | Heterogeneous workloads | |
| 86 | +| `spatial` | Domain decomposition | Simulation, matrices | |
| 87 | +| `keyed` | Group by key | Map-reduce, aggregation | |
| 88 | + |
| 89 | +## Gather Strategies |
| 90 | + |
| 91 | +| Strategy | Description | |
| 92 | +|---------------|--------------------------------------------------| |
| 93 | +| `merge` | Concatenate all results | |
| 94 | +| `reduce` | Apply reduction function (sum, max, min, custom) | |
| 95 | +| `tree-reduce` | Logarithmic reduction for associative ops | |
| 96 | +| `stream` | Results stream back as they complete | |
| 97 | +| `first` | Return first successful result (search) | |
| 98 | + |
| 99 | +# Architecture |
| 100 | + |
| 101 | +Chapeliser follows the hyperpolymath ABI-FFI standard: |
| 102 | + |
| 103 | +- **Idris2 ABI** (`src/interface/abi/`) — Dependent-type **proof |
| 104 | + obligations**, machine-checked in CI |
| 105 | + (`.github/workflows/provable.yml`); the Rust mirror in `src/abi/` |
| 106 | + carries the matching runtime types and checks: |
| 107 | + |
| 108 | + - Partition functions produce complete, non-overlapping splits |
| 109 | + |
| 110 | + - Gather functions preserve all results |
| 111 | + |
| 112 | + - Serialization round-trips are identity |
| 113 | + |
| 114 | + - Memory layouts are consistent across the FFI boundary |
| 115 | + |
| 116 | +<!-- --> |
| 117 | + |
| 118 | +- **Zig FFI** (`src/interface/ffi/`) — C-ABI bridge between: |
| 119 | + |
| 120 | + - The user’s application (any language with C FFI) |
| 121 | + |
| 122 | + - The Chapel runtime (`chpl_*` functions) |
| 123 | + |
| 124 | + - Memory management across the boundary |
| 125 | + |
| 126 | +<!-- --> |
| 127 | + |
| 128 | +- **Chapel codegen** (`src/codegen/`) — Generates: |
| 129 | + |
| 130 | + - `coforall` distribution loops |
| 131 | + |
| 132 | + - Locale-aware data placement |
| 133 | + |
| 134 | + - Communication primitives (GET/PUT/AMO) |
| 135 | + |
| 136 | + - Fault tolerance (retry, checkpoint, redistribute) |
| 137 | + |
| 138 | +<!-- --> |
| 139 | + |
| 140 | +- **Rust CLI** (`src/`) — The `chapeliser` command: |
| 141 | + |
| 142 | + - Parses `chapeliser.toml` |
| 143 | + |
| 144 | + - Validates workload description |
| 145 | + |
| 146 | + - Generates Chapel + Zig + C header scaffolding |
| 147 | + |
| 148 | + - Builds and links everything |
| 149 | + |
| 150 | + - Provides `chapeliser` `run` for execution |
| 151 | + |
| 152 | +# Quick Start |
| 153 | + |
| 154 | +```bash |
| 155 | +# Install (once published to crates.io — see ROADMAP Phase 3) |
| 156 | +cargo install chapeliser |
| 157 | + |
| 158 | +# In your project directory, create chapeliser.toml (see above) |
| 159 | +chapeliser init # generates scaffold from manifest |
| 160 | +chapeliser build # compiles Chapel wrapper + FFI bridge |
| 161 | +chapeliser run # executes locally (1 node) |
| 162 | +chapeliser run -n 8 # distributes across 8 nodes |
| 163 | +chapeliser run --cluster my-cluster.toml # full cluster |
| 164 | +``` |
| 165 | + |
| 166 | +# First Consumer: panic-attacker |
| 167 | + |
| 168 | +The first application to be Chapelised is |
| 169 | +[panic-attacker](https://github.com/hyperpolymath/panic-attacker)’s |
| 170 | +`mass-panic` (assemblyline) mode — distributing static analysis across |
| 171 | +hundreds of repositories on a compute cluster. |
| 172 | + |
| 173 | +# Status |
| 174 | + |
| 175 | +**Pre-alpha.** The Rust CLI and code generator are implemented and |
| 176 | +tested (63 tests). The Idris2 proofs, Zig FFI, and a golden Chapel |
| 177 | +compile-and-run are wired into CI as the verification gate |
| 178 | +(`.github/workflows/provable.yml`) — see `ROADMAP.adoc` Phase 1b for |
| 179 | +their live (green/red) status. Not yet released. |
| 180 | + |
| 181 | +# License |
| 182 | + |
| 183 | +SPDX-License-Identifier: CC-BY-SA-4.0 |
0 commit comments