|
Download worker/README.md from SubstrateCommons/disco-replay: direct link, hf CLI and curl.
- Browser
- Download file 5.06 kB
-
https://huggingface.co/datasets/SubstrateCommons/disco-replay/resolve/main/worker/README.md
- Command line
-
hf download hf://datasets/SubstrateCommons/disco-replay/worker/README.md
-
curl -L -o README.md https://huggingface.co/datasets/SubstrateCommons/disco-replay/resolve/main/worker/README.md
5.06 kB
| # Filling a block from another machine | |
| One process fills blocks in a pipeline: it reads the recipe from this repo, claims a block, walks its voxels on | |
| the local GPU, packs the shard in a subprocess on the CPU and uploads it in a thread -- while the next block | |
| already walks. Machines coordinate through claim files in the repo, nothing else; a claim carries a heartbeat | |
| (the walk's progress, ETA and memory, every ten minutes). Every walk is spooled batch by batch into its run | |
| record, so a killed worker resumes a block from its finished batches, and `--drain` uploads what an earlier | |
| worker on the host left finished. | |
| ```bash | |
| # 1. dmipy-sim (public, github.com/dmrai-lab/dmipy-sim) at the manifest's commit, with a CUDA jaxlib | |
| git clone https://github.com/dmrai-lab/dmipy-sim && cd dmipy-sim && git checkout 64bb9e7 # manifest code.commit | |
| python3.11 -m venv ~/dmipy-venv && . ~/dmipy-venv/bin/activate | |
| pip install -e ".[cuda12]" huggingface_hub | |
| # the CUDA libraries jaxlib loads are in the venv's nvidia/*/lib directories | |
| export LD_LIBRARY_PATH=$(ls -d ~/dmipy-venv/lib/python3.11/site-packages/nvidia/*/lib | tr '\n' ':')$LD_LIBRARY_PATH | |
| export XLA_PYTHON_CLIENT_PREALLOCATE=false | |
| python -c "import jax; print(jax.devices())" # must list the GPU | |
| # 2. log in with a token that can write to SubstrateCommons/disco-replay | |
| hf auth login | |
| # 3. prove the machine on a scaled-down block (a few minutes; a proving run, not part of the pack) | |
| python worker/disco_fill.py --block 0 --budget 30000 --smoke | |
| # (once per variant, done for ground-truth) the certifying walk: block 0's voxels at 2e5 walkers, the full battery | |
| python worker/disco_fill.py --block 0 --budget 200000 --certify | |
| # 4. fill blocks until none is open, pipelined (a session with a time limit: --hours H claims nothing new after H hours); | |
| # a plan in passes (manifest plan.passes) fills pass 1 of every block before pass 2; --pass K takes only pass K | |
| python worker/disco_fill.py --next --loop | |
| # after a crash or a kill: upload what was finished here, release the rest, then fill again | |
| python worker/disco_fill.py --drain && python worker/disco_fill.py --next --loop | |
| ``` | |
| `--variant` selects a recipe from `manifest.json` (default `default_variant`); a pass of a block is claimed, walked | |
| (from its own seed stream, at its scale of the block's counts) and uploaded like a block, as `block-NNNN.pK.rpk`; | |
| the shards are staging: a finished pass is appended to the lossless columnar layout `disco/columns` | |
| (`python -m dmipy_sim.fill.consolidate --append`, the union's weights) and its shards removed; `--batch` lowers the walker batch | |
| on a small card (a GH200 runs 100k); `--workdir` holds the shard while it is built (5 GB free per block). | |
| A worker claims `--claim-batch` blocks (default 3) in one commit and fills them in turn -- the hub allows 128 | |
| commits per repository per hour, and a block costs its claim and its upload -- and releases what is left of the | |
| batch when it stops. Its claim carries a heartbeat every 15 min; a claim not refreshed for 45 min is a dead | |
| worker's, and the next worker that claims releases it (`--drain` on the dead worker's own host does the same at | |
| once, and uploads what it had finished). `python -m dmipy_sim.fill.status --repo SubstrateCommons/disco-replay` reads the hub -- every shard's summary, every claim's | |
| heartbeat, the plan -- and prints the fill's state per contributor (shards, rate, the block in flight, the | |
| heartbeat's age), the time to the end of each pass at the last hour's rate and the commit budget; with | |
| `--publish` it commits that as `STATUS.md`. Every shard carries its own per-voxel | |
| certificate, a `.json` summary with the timings and the sha256 of the shard, and a `.run/` record of the walk | |
| (`python -m dmipy_sim.run <dir>` reads it: the timeline, memory per phase, how it ended); | |
| `certificate/disco-block-0000.run/` is one. | |
| ## A Kaggle GPU session as a worker | |
| `worker/kaggle/` holds a script kernel; every `kaggle kernels push -p worker/kaggle` starts a session that fills | |
| blocks for about 11 hours in rounds of 60k walkers (a 31 GB host, 20 GB of disk, two T4s) and stops. A pushed version cannot | |
| reach Kaggle's secrets service (measured), so the hub token lives in a PRIVATE dataset of the account, `hf-token`, | |
| holding one file `hf_token.txt`, mounted into the session by `dataset_sources`; only the account sees it. Once: | |
| ```bash | |
| pip install kaggle && kaggle auth login # the account's API login | |
| mkdir hf-token && cp <a hub token with write access to this dataset> hf-token/hf_token.txt | |
| echo '{"title": "hf-token", "id": "<user>/hf-token", "licenses": [{"name": "other"}]}' > hf-token/dataset-metadata.json | |
| kaggle datasets create -p hf-token # private by default | |
| ``` | |
| Then, per session (from any machine with the login): | |
| ```bash | |
| kaggle kernels push -p worker/kaggle # rhjfick/disco-fill; your own: edit the id and the dataset | |
| kaggle kernels status rhjfick/disco-fill | |
| kaggle kernels output rhjfick/disco-fill -p out/ # the session's log | |
| ``` | |