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