meshd's CUDA backend: one context that blinks, or --isolation mps with a private MPS daemon and a pool of worker processes; nvJitLink as its compiler
$ sexc add @ajax/mesh-mps- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 02:57v/# 1 version
- drwxr-xr-x-Oct 27 02:57files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 02:57 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-backend ^0.1.0, @ajax/mesh-cuda ^0.1.0, @ajax/cuda-driver ^0.1.0, @ajax/nvjitlink ^0.1.0, @ajax/mesh-mps-wire ^0.1.0, @ajax/mesh-shm ^0.1.0, @ajax/mesh-loader ^0.1.0, @ajax/mesh-manifest ^0.1.0, @ajax/mesh-spawn ^0.1.0, @ajax/mesh-log ^0.1.0, @ajax/mesh-text ^0.1.0, @ajax/mesh-abi-base ^0.1.0, @ajax/mesh-abi-backend ^0.1.0, @ajax/mesh-abi-host-status ^0.1.0, @ajax/mesh-abi-program-table ^0.1.0, @ajax/mesh-check ^0.1.0, @ajax/cuda-driver-fake ^0.1.0, @ajax/mesh-mps-worker ^0.1.0, @ajax/mesh-worker-node ^0.1.0, @ajax/mesh-worker-ctx ^0.1.0, @ajax/mesh-mailbox ^0.1.0, @ajax/mesh-manifest-encode ^0.1.0, @ajax/mesh-abi-header ^0.1.0, @ajax/mesh-abi-ring ^0.1.0, @ajax/mesh-abi-ops ^0.1.0, @ajax/mesh-abi-ext ^0.1.0, @ajax/mesh-abi-control-block ^0.1.0
- dependents
- @ajax/mesh-inproc, @ajax/meshd
- keywords
- mesh alphaos cuda mps backend gpu
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-mps
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-mps 2 3meshd's CUDA backend, both isolation modes: blink (every program a resident kernel of meshd's one context: load, shape, scratch, launch, query, unload) and `--isolation mps` (a private `nvidia-cuda-mps-control` daemon under `--mps-dir`, mode 0700, quit at exit; stale daemons of dead meshds reaped; a pool of idle worker processes started before any program runs; each image preloaded into its own MPS client on the JIT thread; every worker checked to be a client of our server; back to the pool after an unload). The compiler checks the manifest, the PTX hash, the node's block limits and register cap, and links with nvJitLink. Also the native GPU workers' server check and pipe dir. 4 5## Differences 6 7- Worker processes run in a process group of their own (a terminal's ^C reaches meshd, which stops them at exit), as native workers do. 8- An unknown CUresult prints as `cudaError_enum(N)`. 9 10## Ported from 11 12[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT): crates/mesh-host/src/mps.rs (`Gpu`, `Kernel`, `Stream`, `CudaBackend`, `CudaCompiler`, the daemon, `Mps`, `Proc`, `Worker`, the pool, `cleanup`, `native_pipe_dir`, `check_native`). 13 14## Tests 15 16`tests/mps.c`, without a GPU: blink mode over @ajax/cuda-driver-fake (a launched kernel plays the program's node loop on the real mailbox: 100 tickets, a halt, the shape and occupancy facts, compiler refusals with their messages) and `--isolation mps` for real: the test binary is also a fake `nvidia-cuda-mps-control` (on PATH) and the `meshd worker` processes (on the fake device), so the daemon starts, the pool's worker comes up and is checked as a client, two programs run through it one after the other (the second reuses the pooled worker), and the cleanup kills the workers and quits the daemon. 17 18## Licence 19 20MIT. See the repository's LICENSE.