S-exp GPU
All pages
Docs · The command lineMarkdown

sweep

sexpgpu sweep <file.sx> <sweep> enumerates a declared defsweep and runs its points in order, each as a run in this process. To run the points side by side, each as its own job on its own machine, launch the same sweep with rrun --sweep.

$ sexpgpu sweep my-run.sx lr-scan --dry-run
0  lr=0.5  my-run-lr=0.5
1  lr=0.25  my-run-lr=0.25
flagmeaning
--dry-runcompile each point and print the enumeration (index, selection, slug) on standard output and run nothing
--jsonwith --dry-run, print the JSON plan described below
--only <points>run only these points, in declaration order: 3, 0,4 or 2-5; one past the end exits 2
--set k=vpin a knob for every point; pinning an axis or a knob used by any row exits 2
--variant Vthe base variant, when the sweep names none
--diagnostics Gthe diagnostics selection of every point

It also takes run's flags but --steps, --json, --data-map and --records, each for every point. --resume takes only latest: each point continues the newest checkpoint in its own location, or starts fresh when it has none, so one command starts, restarts and continues the sweep; a named checkpoint cannot start every point and exits 1.

  • Each point's line goes to standard error as it starts, followed by what run prints for it, its configuration line through its done: block; a table of point, slug, final evaluation (eval/loss when reported) and metrics location closes the sweep.
  • Each point's line shows its explicit knob values; its slug includes the variant and the effective overrides.
  • Every selection is compiled and checked before it runs; rows and axes are evaluated under the pinned --variant and --set.
  • The first failure stops the sweep and names the point, point 2 of `lr-scan` does not compile before its diagnostics, or point 2 of `lr-scan` failed after the run's error.
  • A point that does not end done stops the sweep with incomplete (budget-limited), exit code 1, or incomplete (interrupted). SIGTERM, SIGINT or SIGHUP stops the point as it stops a run, with its checkpoint and its status file, and the sweep exits 128 + n as run does. The point is not in the results table, and later points do not start.
  • A JSONL metrics target and a status file each get -<index> before the extension, one per point: status.json becomes status-0.json, status-1.json.
  • A checkpoint location gets each point's slug; see checkpoint locations.
  • A sweep the file does not declare exits 2.
  • An axis that lists one value twice, or :rows that list one row twice, is E-KNOB-007, raised by every compile of the file: the two points would be one run under one slug. A sweep name declared twice is E-KNOB-009.

Checkpoint locations

A location holds one run, so each point checkpoints under the sweep's location in a directory named after its slug: SEXPGPU_CHECKPOINT_DIR=s3://bucket/sweep checkpoints a point to s3://bucket/sweep/<slug>.

An o41:// artifact is named in letters, digits, ., _ and -. A slug of only those is used as it is. In any other slug each other character becomes - and the first eight hex digits of the slug's SHA-256 follow, so two slugs never share a location: the point my-run-lr=0.5 of SEXPGPU_CHECKPOINT_DIR=o41://my-team/sweep checkpoints to o41://my-team/sweep/my-run-lr-0.5-3cfdb246. rrun --sweep --dry-run prints each point's location.

JSON plans

$ sexpgpu sweep my-run.sx lr-scan --dry-run --json
{"schema_version":1,"entry":"my-run.sx","sweep":"lr-scan","points":[...]}

Each object in points contains:

fieldmeaning
pointzero-based declaration index, unchanged by --only
variantselected variant name, or null
knobseffective values as the setup records them: name, value, source
slugthe point's run slug
argvargument array beginning with sexpgpu, run, and the entry path

Knob sources are default, variant, set, or override; row and axis values are set. Numbers and booleans stay JSON values; keywords and compound data are source strings. argv carries the variant, the evaluated explicit overrides (compound data quoted so a replay does not evaluate it twice) and any diagnostics override. An override that would not read back as itself cannot be exported: a function or other non-data value, a NaN or an infinity, a symbol made by gensym.

Run argv as an argument array, without shell quoting, from the same working directory and sources; replace run with ir or check to check it. The plan holds selections only: device, metrics, checkpoints, environment and scheduling are the launcher's. Every requested point must compile before the plan is printed; --only checks and exports its points alone.

--json without --dry-run exits 2, and so does any flag sweep does not take, --steps, --data-map and --records among them (flags); to vary steps, declare a knob used by defrun :steps. A pinned --set may not name a knob used by any row, even when some rows omit it:

$ sexpgpu sweep my-run.sx confirmation --dry-run --set width=128
sexpgpu sweep: `width` is an axis or row knob of `confirmation`; drop the `--set` or sweep without it

--time-limit and --final-eval-reserve, or SEXPGPU_TIME_LIMIT and SEXPGPU_FINAL_EVAL_RESERVE, apply to each point separately, never to the whole sweep; each clock starts when that point starts compiling, as a run's does. A point that finishes every step and final pass but overruns is done, with within_budget false; see time budgets.

Related: knobs, run, the status file.