Skip to content

Phase 2 of #1: re-dispatch the cloud runs until EC2 capacity appears #9

Closed

Description

@mmcky

Phase 2 of #1 measures the two cards project-compute is choosing between, plus a float64 ceiling, on RunsOn. Its runs can't start, because AWS has no on-demand capacity for them in RunsOn's zones. This issue records the workaround, a loop that keeps re-dispatching the runs, and how to restart it on qe-mini1.

The runs

Instance Card Stands in for Devices USD/hr
g7e.2xlarge RTX PRO 6000 Blackwell Server Edition RTX PRO 6000 Max-Q cpu,gpu 3.36
p4d.24xlarge 8× A100 SXM4 40 GB A800 40GB Active gpu,gpu:2 21.96
p5.4xlarge H100 80 GB float64 ceiling, optional cpu,gpu 6.88

Each is a full run with precision_extras on: the matrix, a matmul pass with TF32 off, and the aiyagari_jax and ifp_egm_jax scale scripts. They dispatch from the branch phase2-cloud-cards, which holds the workflow changes. A quick T4 run checked that branch end to end on 2026-10-25. Spend is capped at about USD 50 in all, and each job stops after 60 minutes, so the worst case is about USD 32.

Why they don't start

  • No on-demand capacity in RunsOn's two zones. RunsOn's network has subnets only in us-west-2a and us-west-2b. On 2026-10-25, every launch of all three types failed there with InsufficientInstanceCapacity.
  • RunsOn gives up after about 45 minutes, in one of two ways. On the first batch it made six launch attempts, then logged "Queued job exhausted its retry budget and remains queued on GitHub", and the jobs stayed queued without ever launching. On the second it made five, then started a small spot "fallback" instance (an m8i-flex.large or m8id.large) that picked the job up and failed it at "Set up runner" with "Failed to launch runner: We were unable to schedule this runner after 5 attempts". That costs a fraction of a cent and runs nothing.
  • Spot is no way round it. AWS scores spot capacity 1 out of 10 for all three types in every us-west-2 zone, which suggests the whole region is short.
  • RunsOn's logs show this: the CloudWatch log group /aws/ecs/runs-on-v3/runs-on-worker in us-west-2, filtered by the run's id. Reading them needs AWS access, which qe-mini1 doesn't have.

The retry loop

precision/phase2_retry.sh on phase2-cloud-cards:

  • Every two hours it cancels each run still queued, and dispatches a fresh one in place of each run that is queued or was failed by RunsOn's fallback. RunsOn then makes a new round of attempts.
  • Every five minutes it checks whether a run has launched, meaning its Checkout step has started on the requested instance, and exits as soon as one has, so the session running it can watch that run. A fallback failure never reaches Checkout.
  • It never cancels or re-dispatches a run that has launched, so a run that fails can't be paid for twice.
  • It stops after 48 hours.
  • Its state file has one line per instance still to run: the instance, its devices, and its current run id, or - for none. The script rewrites the file, and appends each dispatch to <state file>.log.

It started on 2026-10-25 at 20:11 AEDT on Matt's laptop, and stops when that session closes. Its last dispatches are in the first comment below.

Restarting it on qe-mini1

Run only one copy. Two loops would cancel each other's runs. On the laptop, pkill -f phase2_retry.sh stops the old one if it is still going.

cd ~/bench/benchmarks
git fetch -q origin && git switch phase2-cloud-cards && git pull -q
# Cancel Phase 2 runs that RunsOn has given up on
gh run list -R QuantEcon/benchmarks --workflow benchmark.yml --branch phase2-cloud-cards --status queued \
    --json databaseId --jq '.[].databaseId' | xargs -n1 gh run cancel -R QuantEcon/benchmarks
# One line per instance still to run; drop any that have finished
printf 'g7e.2xlarge cpu,gpu -\np4d.24xlarge gpu,gpu:2 -\np5.4xlarge cpu,gpu -\n' > ~/bench/phase2_state.txt
tmux new -d -s phase2 'bash precision/phase2_retry.sh ~/bench/phase2_state.txt 48 7200 2>&1 | tee ~/bench/phase2_retry.out'

qe-mini1's gh is signed in with the workflow scope, which dispatching and cancelling need (checked 2026-10-25). The loop starts by dispatching all three.

When a run launches

  1. Watch it to the end: gh run watch <run id> -R QuantEcon/benchmarks.
  2. If it failed, read the log before trying again. For example, the p4d's fabric-manager step has never run, and neither has a Blackwell card on this image. The image's driver, 580.105.08, uses the open kernel module that Blackwell needs.
  3. Download the results: gh run download <run id> -R QuantEcon/benchmarks -D <directory>. The artifact holds results/runson-<instance>/ and lectures/results/runson-<instance>/, which go on phase2-cloud-cards with the findings.
  4. Restart the loop for the instances still waiting. Keep their lines in the state file with their current run ids, so the loop cancels those before it re-dispatches.

If capacity never appears

Renting outside RunsOn, for example Lambda's single A100 40 GB at USD 1.99 an hour for the A800's stand-in, is Matt's decision, to consider later. The status is tracked in QuantEcon/project-benchmarks-jax#1.

🤖 Generated with Claude Code

Activity

  1. mmcky commented on Oct 25, 2026

    @mmcky
    ContributorAuthor

    Dispatches so far (AEDT). The loop is running on Matt's laptop.

    Time Instance Run Outcome
    2026-10-25 18:29 g7e.2xlarge, p4d.24xlarge, p5.4xlarge 40172971142, 40172975619, 40172980082 No capacity in us-west-2a or 2b; RunsOn gave up at 19:14; cancelled at 20:08
    2026-10-25 20:11 g7e.2xlarge 40179627488 Queued
    2026-10-25 20:11 p4d.24xlarge 40179629876 Queued
    2026-10-25 20:11 p5.4xlarge 40179631745 Queued

    The next round is due at about 22:11, if none of these launches first.

  2. mmcky commented on Oct 25, 2026

    @mmcky
    ContributorAuthor

    Second round, and a fix to the loop (AEDT).

    Time Instance Run Outcome
    2026-10-25 20:11 all three 40179627488, 40179629876, 40179631745 Five attempts each, all InsufficientInstanceCapacity; at 20:50 RunsOn failed them from fallback instances
    2026-10-25 20:53 g7e.2xlarge 40182535764 Queued
    2026-10-25 20:53 p4d.24xlarge 40182537831 Queued
    2026-10-25 20:53 p5.4xlarge 40182540074 Queued

    The loop took the fallback failures for launches and stopped. Since 6eae59a it counts a run as launched only once its Checkout step has started, and re-dispatches one that failed before that. It restarted at 20:53 on Matt's laptop; the next round is due at about 22:53.

  3. mmcky commented on Oct 25, 2026

    @mmcky
    ContributorAuthor

    Plan revised (2026-10-25, from project-compute): split the providers. EC2 is short of capacity for all three types, so:

    Card Where USD/hr State
    A100 40 GB, standing in for the A800 Lambda, a 1× A100 40 GB instance, by hand 1.99 Needs a Lambda account and API key (Matt, 2026-10-26)
    RTX PRO 6000 Blackwell, standing in for the Max-Q RunsOn g7e.2xlarge if it launches; otherwise RunPod's RTX PRO 6000 (secure cloud), by hand. g7e in us-east-2 only with Matt's yes, since it is outside RunsOn 3.36 · 2.49 Retrying on RunsOn until this session closes; RunPod needs an account
    H100 Dropped, unless Matt approves a p5.4xlarge Capacity Block — —

    The p4d and p5 runs are cancelled. The retry loop now holds only the g7e: run 40183653582, dispatched 21:10 AEDT.

    On every card: the precision matrix; matmul again with TF32 off; five lectures as written, three times each (overborrowing, wealth_dynamics_jax, schelling_shocks, opt_invest, hopenhayn); and the aiyagari_jax and ifp_egm_jax scale scripts. As a bonus, if Lambda has a 2× A100 free, the Bellman workloads as gpu:2, with nvidia-smi topo -m showing whether the cards share NVLink. The budget is about USD 50 in all; check with Matt before going over, or before any Capacity Block.

    Ready on phase2-cloud-cards:

    • precision/run_by_hand.sh <provider>-<instance> [devices] [--quick] does all of the above on a rented machine. It records nvidia-smi, its topology, the driver and the CPU; installs Python 3.12 with uv; picks jax[cuda13] on a 580+ driver, and otherwise jax[cuda12] with a cuda12 label; stops if JAX sees no GPU; and packs everything into <host>-<date>.tgz. It passed a --quick test from a fresh clone on qe-wharton1-gpu.
    • precision/lambda.sh drives Lambda's API: capacity, wait, add-key, launch, list and terminate. The capacity field is regions_with_capacity_available, confirmed from Lambda's OpenAPI spec 1.10.0. The script was checked against the live API with a dummy key, which every subcommand reports as global/invalid-api-key.
    • The workflow's precision_extras now also runs the five lectures, for a g7e that launches on RunsOn. Quick check: run 40184217121 on a T4. Read its result before relying on that step.

    Tomorrow, for the A100 on Lambda (from qe-mini1, in a checkout of phase2-cloud-cards):

    1. Create the Lambda API key and save it to ~/.config/lambda/api_key with chmod 600. Don't paste it into a chat.
    2. bash precision/lambda.sh add-key registers ~/.ssh/id_ed25519.pub. Then bash precision/lambda.sh capacity a100 shows the A100 types, their prices and where they are free.
    3. bash precision/lambda.sh wait <type> gives a region. bash precision/lambda.sh launch <type> <region> gives an instance id, and list gives its IP once it is active.
    4. On the instance, as ubuntu: clone phase2-cloud-cards, then in tmux run bash precision/run_by_hand.sh lambda-<type>.
    5. Copy the .tgz off the instance, then bash precision/lambda.sh terminate <id>, and check list to make sure it is gone.

    For the RTX PRO 6000 on RunPod: start a secure-cloud pod with SSH, then follow step 4 with host runpod-rtx-pro-6000. The script's GPU check is the Blackwell smoke test. Stop and delete the pod afterwards.

    Also tomorrow: qe-wharton2's M5 Pro (64 GB) is being connected. Once it is onboarded it joins the precision matrix and #4's whole-lecture set, as the M6 did.

  4. mmcky commented on Nov 1, 2026

    @mmcky
    ContributorAuthor

    Closing: Phase 2 ran outside RunsOn, so the retry loop is no longer needed. RunsOn never got capacity for these types in us-west-2a or 2b, so on 2026-10-26 the cards were rented by hand instead, as the revised plan above proposed:

    Card Where Stands in for
    A100 SXM4 40 GB Lambda The A800 40GB Active
    RTX PRO 6000 Blackwell Server Edition EC2 g7e.2xlarge, on demand in us-east-2a, outside RunsOn The RTX PRO 6000 Max-Q
    H100 SXM5 80 GB Lambda A float64 ceiling
    A10 24 GB Lambda The A10G in RunsOn's g5

    The run record, with the hosts, the cost (about USD 6) and what didn't run, is precision/runs/2026-10-26/README.md. The follow-up sessions of 2026-11-01 are in #21.

    No Phase 2 run is queued or running on phase2-cloud-cards, and the loop isn't running anywhere (checked 2026-11-01). If a later phase needs a card RunsOn can't place, this issue still describes the loop and its restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions