Optimize Slurm Topology
Use this workflow to iteratively improve AlpaSim rollout throughput on Slurm. Optimize for full 20s rollout throughput, not startup-only behavior.
Inputs
When this skill is invoked, the user must specify a full run command as starting
point for the optimization. This command provides a base topology as starting
point, as well as the target configuration (e.g. driver, sceneset, n_rollouts,
cluster, and any other parameters such as number of cameras, simulation
frequency, etc.).
If the user doesn't specify a full run command, ask them!
Telemetry and Memory Setup
Use one persistent local Prometheus/Grafana instance for the whole experiment.
- Start local telemetry once with
src/tools/scripts/start-prometheus-grafana.sh <file-sd-dir-or-ssh-path> --grafana-port 3003 --prometheus-port 9093. Use the non-default ports to
avoid conflicts with user-started telemetry stacks.
- The
<file-sd-dir-or-ssh-path> argument is provided by the experiment logs.
For example, the default value on IAD is
<iad-ssh-alias>:/lustre/fsw/portfolios/av/projects/av_alpamayo_reasoning/data/av_alpamayo_sim/.cache/prometheus/file-sd
- Keep the local telemetry stack running until all experiment candidates have
been evaluated. Then stop it with
src/tools/scripts/start-prometheus-grafana.sh stop
- Create a repo-local experiment record from
references/experiment-record.md.
Default path:
docs/experiments/topology-opt-<driver>-<cluster>-<YYYYMMDD>.md. This file will be your experiment log and memory. It should contain all necessary information to understand why a topology was tried and what the results were.
Experiment Loop
- Start from a known topology and run a baseline experiment.
- If you already have a baseline, start one or multiple candidate experiments
in parallel (at most 3).
- The experiments have an initial startup time of a couple of about 5 min
before they appear in Prometheus. After that, they start producing rollouts.
However, because all rollouts are initially started simultenously, there's
significant congestion in the first 10-15 minutes. Wait until you can see
this congestion has cleared and the system has reached a steady state. Use
the 5m
seconds_per_rollout only as an early diagnostic. Once the full-run
seconds_per_rollout has stabilized, typically after 30-45 minutes, use it
as the primary optimization target.
- Reject candidates that OOM or crash. Analyze the reason for failure and avoid
repeating the same mistake. A typical reason is insufficient GPU memory.
- Once a candidate reaches steady state, analyze it carefully and document (see
references/metrics.md and references/topology-knobs.md):
- Its stabilized full-run
seconds_per_rollout, using the 5m value only to
diagnose recent behavior and confirm that the run remains healthy.
- Its bottlenecks, using
alpasim:rpc_queue_depth_at_start_latest:max as the primary bottleneck
signal and alpasim:rpc_queue_depth_at_start_latest:min to detect workers
that are starving or receiving uneven load.
- Its used and available resources, including per-GPU utilization, memory
consumption, memory pressure, and memory headroom.
- Opportunities for improvement.
- Skill improvement reflections: Did you learn something new about the system
that was not yet covered in the skill? This can include, for example:
- How to run experiments or query results.
- Which Prometheus queries are useful.
- How the topology knobs affect throughput and memory.
- Are there additional metrics that we should introduce to better understand
the system?
- Any additional scripts that you wrote to help with the experiments that
would be useful to add to the skill.
- Or anything else that you think is useful to remember for future
experiments.
- Keep two record sections current (see
references/experiment-record.md).
These records should include the output of both step 4 and step 5, and should
be updated after every candidate experiment:
- a short Markdown progress document (including table) for humans and quick
parsing;
- a more detailed JSON memory block with fixed inputs, runs, metrics, GPU
utilization, GPU memory consumption and headroom, decisions, and links to
run artifacts.
- Decide on the next topology changes and go back to step 1.
- You should stop running experiments as soon as you have enough data to
support your reasoning and decision. It is not required to let them run until
the end. However, do not compare or stop a healthy candidate before its
full-run
seconds_per_rollout has stabilized, normally 30-45 minutes after
rollout production begins. Note that "steady state" can still contain cyclic
behavior.
- Stop when you can't make progress over multiple iterations or when you don't
believe there is more enough free resources to improve throughput.
Supporting documents
- Read
references/experiment-record.md for how to keep a record of the experiment and its candidates.
- Read
references/metrics.md for current metric names, PromQL queries, and interpretation.
- Read
references/topology-knobs.md for guidelines on how to change topology and what to expect from each change.
Final Reporting
At the end of the optimization, re-read the experiment record and summarize the
results in a DETAILED final report, including:
- Baseline topology and initial speed (primary stabilized full-run
seconds_per_rollout, plus 5m seconds_per_rollout for recent-behavior
context), including per-GPU utilization and memory consumption/headroom.
- All tried topologies, their reasoning, expected effect, measured result,
resource usage, and decision.
- Best topology found, why it won, remaining bottlenecks or constraints, and
how much GPU utilization and memory headroom remains for further tuning.
- Any advice on how the skill or the instructions can be improved.
- Link the repo-local experiment record.
1---2name: optimize-slurm-topology3description: Optimize AlpaSim Slurm topology throughput using persistent local Prometheus/Grafana telemetry and run artifacts. Use when tuning service GPU placement, replicas_per_container, runtime.nr_workers, endpoint n_concurrent_rollouts, NRE/physics cache sizes, or Slurm experiment batches for full-duration rollout throughput.4---56# Optimize Slurm Topology78Use this workflow to iteratively improve AlpaSim rollout throughput on Slurm. Optimize for full 20s rollout throughput, not startup-only behavior.910## Inputs1112When this skill is invoked, the user must specify a full run command as starting13point for the optimization. This command provides a base topology as starting14point, as well as the target configuration (e.g. driver, sceneset, n_rollouts,15cluster, and any other parameters such as number of cameras, simulation16frequency, etc.).1718If the user doesn't specify a full run command, ask them!1920## Telemetry and Memory Setup2122Use one persistent local Prometheus/Grafana instance for the whole experiment.23241. Start local telemetry once with25 `src/tools/scripts/start-prometheus-grafana.sh <file-sd-dir-or-ssh-path>26 --grafana-port 3003 --prometheus-port 9093`. Use the non-default ports to27 avoid conflicts with user-started telemetry stacks.282. The `<file-sd-dir-or-ssh-path>` argument is provided by the experiment logs.29 For example, the default value on IAD is30 `<iad-ssh-alias>:/lustre/fsw/portfolios/av/projects/av_alpamayo_reasoning/data/av_alpamayo_sim/.cache/prometheus/file-sd`313. Keep the local telemetry stack running until all experiment candidates have32 been evaluated. Then stop it with `src/tools/scripts/start-prometheus-grafana.sh stop`334. Create a repo-local experiment record from `references/experiment-record.md`.34 Default path:35 `docs/experiments/topology-opt-<driver>-<cluster>-<YYYYMMDD>.md`. This file will be your experiment log and memory. It should contain all necessary information to understand why a topology was tried and what the results were.3637## Experiment Loop38390. Start from a known topology and run a baseline experiment.401. If you already have a baseline, start one or multiple candidate experiments41 in parallel (at most 3).422. The experiments have an initial startup time of a couple of about 5 min43 before they appear in Prometheus. After that, they start producing rollouts.44 However, because all rollouts are initially started simultenously, there's45 significant congestion in the first 10-15 minutes. Wait until you can see46 this congestion has cleared and the system has reached a steady state. Use47 the 5m `seconds_per_rollout` only as an early diagnostic. Once the full-run48 `seconds_per_rollout` has stabilized, typically after 30-45 minutes, use it49 as the primary optimization target.503. Reject candidates that OOM or crash. Analyze the reason for failure and avoid51 repeating the same mistake. A typical reason is insufficient GPU memory.524. Once a candidate reaches steady state, analyze it carefully and document (see53 `references/metrics.md` and `references/topology-knobs.md`):54 * Its stabilized full-run `seconds_per_rollout`, using the 5m value only to55 diagnose recent behavior and confirm that the run remains healthy.56 * Its bottlenecks, using57 `alpasim:rpc_queue_depth_at_start_latest:max` as the primary bottleneck58 signal and `alpasim:rpc_queue_depth_at_start_latest:min` to detect workers59 that are starving or receiving uneven load.60 * Its used and available resources, including per-GPU utilization, memory61 consumption, memory pressure, and memory headroom.62 * Opportunities for improvement.635. Skill improvement reflections: Did you learn something new about the system64 that was not yet covered in the skill? This can include, for example:65 * How to run experiments or query results.66 * Which Prometheus queries are useful.67 * How the topology knobs affect throughput and memory.68 * Are there additional metrics that we should introduce to better understand69 the system?70 * Any additional scripts that you wrote to help with the experiments that71 would be useful to add to the skill.72 * Or anything else that you think is useful to remember for future73 experiments.745. Keep two record sections current (see `references/experiment-record.md`).75 These records should include the output of both step 4 and step 5, and should76 be updated after every candidate experiment:77 - a short Markdown progress document (including table) for humans and quick78 parsing;79 - a more detailed JSON memory block with fixed inputs, runs, metrics, GPU80 utilization, GPU memory consumption and headroom, decisions, and links to81 run artifacts.826. Decide on the next topology changes and go back to step 1.837. You should stop running experiments as soon as you have enough data to84 support your reasoning and decision. It is not required to let them run until85 the end. However, do not compare or stop a healthy candidate before its86 full-run `seconds_per_rollout` has stabilized, normally 30-45 minutes after87 rollout production begins. Note that "steady state" can still contain cyclic88 behavior.898. Stop when you can't make progress over multiple iterations or when you don't90 believe there is more enough free resources to improve throughput.9192## Supporting documents9394* Read `references/experiment-record.md` for how to keep a record of the experiment and its candidates.95* Read `references/metrics.md` for current metric names, PromQL queries, and interpretation.96* Read `references/topology-knobs.md` for guidelines on how to change topology and what to expect from each change.9798## Final Reporting99100At the end of the optimization, re-read the experiment record and summarize the101results in a DETAILED final report, including:1021031. Baseline topology and initial speed (primary stabilized full-run104 `seconds_per_rollout`, plus 5m `seconds_per_rollout` for recent-behavior105 context), including per-GPU utilization and memory consumption/headroom.1062. All tried topologies, their reasoning, expected effect, measured result,107 resource usage, and decision.1083. Best topology found, why it won, remaining bottlenecks or constraints, and109 how much GPU utilization and memory headroom remains for further tuning.1104. Any advice on how the skill or the instructions can be improved.1115. Link the repo-local experiment record.