Emulate rank 0 on one GPU
Use --emulate-rank-zero to profile the per-rank work of a multi-GPU deployment on a single GPU. The flag runs only global rank 0 of the configured layout.
Prerequisites
TokenSpeed supports the flag only with the following configuration:
- Use AMD GPUs on one node.
- Configure a parallel layout with more than one rank.
- Disable pipeline, context, and attention data parallelism.
- Keep the MoE TP × EP size equal to the attention TP size.
- Do not use
--mm-encoder-tp-mode data, PD disaggregation, fused all-reduce,--enable-eplb, or an--all2all-backendtransport.
A typical launch combines --emulate-rank-zero with --load-format dummy, which reads only the model's config and tokenizer, not its weights. When you use dummy weights, set TOKENSPEED_MOE_ROUTING_SIMULATION=uniform before startup so tokens spread over experts instead of all picking the same ones. With chain-based speculative decoding, also set TOKENSPEED_SPEC_SIMULATED_ACCEPT_LEN to the avg_accept_len of a real run.
Start the emulated rank
Replace
<model>with your model ID or local path, and then start rank 0 of a TP8 layout with dummy weights:bashTOKENSPEED_MOE_ROUTING_SIMULATION=uniform \ tokenspeed serve <model> --tp 8 --emulate-rank-zero --load-format dummyThe layout resolves as usual (TP8 here), so the rank builds the weight shards, kernels, and cache sizing that rank 0 of the full deployment would. Its collectives are local stand-ins that return the real shapes and dtypes, filled from this rank's operand alone.
Confirm that startup resolves the intended full layout and builds rank 0's shards and cache sizing. Do not use the output for correctness validation.
Compared with the real rank:
- Communication takes no time, and the fused all-reduce paths are off because they need peers; their epilogues run as separate kernels.
- Values after a reduction are this rank's partial results, so outputs are not meaningful and data-dependent work such as MoE routing follows the emulated values.