Builds the mesh program catalog: each program's PTX (linked and checked in the cluster float mode), wasm image, native binary and source hash, and its variants
$ sexc add @ajax/mesh-build-programs- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 03:26v/# 1 version
- drwxr-xr-x-Oct 27 03:26files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 03:26 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-catalog-toml ^0.1.0, @ajax/mesh-ptx-float-rules ^0.1.0, @ajax/mesh-source-hash ^0.1.0, @ajax/mesh-check ^0.1.0
- dependents
- none yet
- keywords
- mesh alphaos build catalog ptx wasm
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/apps/mesh-build-programs
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-build-programs 2 3``` 4mesh-build-programs [-C DIR] [name...] 5``` 6 7Builds every mesh program under `programs/` (or the named ones) into the catalog meshd loads from, 8`out/programs/<name>/`: 9 10| Image | How | Checked | 11|---|---|---| 12| `<name>.ptx` | `sexc build --release` of the program's `ptx` package, then `mesh-ptx-link` on its bitcode (the cluster float mode, only `mesh_main` and `MESH_RT_ABI` exported) | `.target <arch>` exactly (no `debug`), the float rules (@ajax/mesh-ptx-float-rules), the `mesh_main` entry, `MESH_RT_ABI` | 13| `<name>.wasm` | the program's `wasm` package (`programs/<name>-wasm`, from the wasm builder) | the `mesh_init`, `mesh_task`, `mesh_rt_abi` exports | 14| `<triple>/<name>`, `source.hash` | a native program's `executable` package; `# build-os:` limits it to one OS | the source identity (@ajax/mesh-source-hash) | 15| `program.toml` | copied | its `name` must be the folder's | 16 17Then each `programs/<name>/variants/<v>.toml` gets `out/programs/<v>/` with the same images under its 18name. Everything lands by rename, so a running meshd never reads half a file. 19 20Environment: `MESH_PROGRAMS_OUT` (the catalog), `MESH_PTX_ARCH` (default `sm_86`: meshd JITs it for the 21GPU it runs on), `MESH_WASM_ONLY=1`, `MESH_NATIVE_ONLY=1`, `MESH_SKIP_WASM=1`, `SEXC`, `MESH_PTX_LINK`. 22 23- **Ported from:** alpha-rust-mesh `scripts/build-programs.sh`. 24- **Differences:** 25 - Images come from sexc packages, not cargo. 26 - A wasm image comes from a `programs/<name>-wasm` package; the Rust pinned wasm builds to one rustc, 27 and here clang builds them. 28 - `MESH_SKIP_WASM=1` is new, so a catalog can be built for CUDA and native members before the wasm 29 images exist. 30 - Native programs build with sexc's `release` profile; the Rust added `-C target-cpu=native`. 31 - There is no `program.metal`, because the Metal backend is not ported. 32- **Tests:** 33 - package ids, the arch rule and sexc.json fields; 34 - on temporary trees with no tools: a wasm-only program with its variant, a native program for another 35 OS (manifest and source hash, no binary), a GPU program failing without its tools, and a wrong arch, 36 variant name and manifest name all refused. 37 - The whole catalog was built with it on this machine (12 GPU images, 3 native, 7 variants).