S-exp GPU
All pages
Docs · The command lineMarkdown

The command line

One binary, sexpgpu, authors a run (new, fmt, variants, watch), checks it (check, explain, diff, ir, eval, probe), runs it (run, sweep), evaluates it from its checkpoints (evaluate), packs it for another machine (bundle) or launches it on one (rrun), and runs the trained model (export, serve); doctor, checkpoint, update, feedback and docs serve the rest. There is no run management: a run is one process, and whatever starts it (a terminal, a job runner, a scheduler) owns the rest. rrun hands the run to rrun, which owns it from there.

sexpgpu --help (or -h) prints the full usage and exits 0. sexpgpu <verb> --help prints that command's synopsis, accepted options and a documentation link, without needing a file, credentials or a device. It includes selection flags and distinguishes a checkpoint-evaluation bundle's options. Help goes to standard output. Use -- before a literal operand named --help; option values such as --expr '"--help"' remain data. An unknown command still exits 2, including when given --help.

Verbs

verbargumentswhat it doespage
check<file.sx> [--data] [--checkpoint C] [--json] [--timings]compile and report diagnostics; --data also checks source metadata and sample recordscheck
watch<file.sx> [--timings]check again on every change, until Ctrl-Ccheck
explain<file.sx> [--checkpoint C] [--device cpu|reference|cuda|rocm|metal] [--cpu-cores N] [--json]what the compiler made of the file, and with a device what the executor makes of itexplain
diff<a.sx> <b.sx> [--b-variant V] [--b-set k=v]... [--json]what changed between two runs, or two selections of oneexplain
ir<file.sx> [--checkpoint C] [--graph <name|id>] [--model <path>] [--digest]the experiment, graph, or model region as JSON, or the experiment's digestexplain
eval[<file.sx>] [--expr FORM] [--json]each top-level value, or one expression in the selected file or the preludeexplain
probe[<file.sx>] --expr FORM [--json] [--max-elements N]small tensors computed on the CPU, without a training contractprobe
fmt<file.sx>... [--check] [--stdout]rewrite files in the one fixed layoutnew
variants<file.sx>the knobs, variants and sweeps the file declaresnew
new<target.sx> --from <file> | --example <name> [--knob k=v]...start a run from a template, another run or a built-in examplenew
run<file.sx>run the experimentrun
evaluate<file.sx> --checkpoint <location/step-N|latest> [--pass P]... [--follow] [--poll S] [--from-step N|latest] [--set k=v]... [--metrics-slug S]run the file's passes from a run's checkpoints, into the run's metrics at each checkpoint's stepevaluation
sweep<file.sx> <sweep> [--dry-run [--json]] [--only <points>]run every point of a declared sweep, each as run with its flags but --steps, --json, --data-map and --recordssweep
bundle<file.sx> -o <dir> [--binary <sexpgpu>] [--checkpoint <location/step-N> [--pass P]... [--set k=v]... [--metrics-slug S]]one directory that runs the experiment anywhere, or evaluates that checkpointbundle
rrun<file.sx> --gpu <choices>|--cpu-only [--spot] [--checkpoint-dir <location>] [--metrics <target>] [--sweep <sweep> [--only <points>] [--dry-run]] [--json]bundle the run and launch it as an rrun job, which o41-rrun follows; with --sweep, every point of a declared sweep as its own job from one bundlebundle
checkpoint<dir>|s3://bucket/prefix/step-<n>what a checkpoint holds: its experiment, step and tensorscheckpoints
export<file.sx> --checkpoint <location[/step-N]> -o <dir> [--trained] [--drop-recorded-knob K]...a checkpoint's model and weights as one directoryinference
serve<location[/step-N]|dir> --socket <path> [--batch N] [--output NAME]... [--at] [--precision bf16] [--trained] [--device cpu|reference|cuda|rocm|metal] [--cpu-cores N]a checkpoint's model, or an exported one, behind a Unix socket, bytes in and bytes out, up to N calls run togetherinference
serve<file.sx> --checkpoint <location[/step-N]> --pass P --socket <path> [--set k=v]... [--device D] [--cpu-cores N] [--deterministic]one evaluation pass, taking loader fields and returning recorded rows over a Unix socketinference
doctor—can a run start here, and with whatdoctor
update[--check] [--channel stable|nightly]replace this binary with the newest published release of its channel; --check only says whether there is oneinstall
feedback[--bug] [--reply-to <email-or-url>] <message|->send a bug report or feedback, with the binary's version and the system, to SexpGPU's authors; - reads the message from standard inputfeedback
docssearch <words>... [--limit N] [--json]the pages of these docs that best answer the words, best firstdocs search

sexpgpu --version prints sexpgpu <version> and exits 0. sexpgpu alone prints the usage on standard error and exits 2.

The selection

evaluate takes the selection its checkpoint records, and --set on top of it when the parameters stay the checkpoint's; see another knob.

check, explain, diff, watch, ir, eval, probe, run, variants, bundle (without --checkpoint) and rrun take:

flagmeaning
--variant <name>select a declared variant
--set <knob>=<value>set a knob, repeatable
--steps Nreplaces defrun :steps and binds a knob named steps. See the knob steps
--diagnostics <glob,glob>replaces defrun :diagnostics; '' selects none. See diagnostics

For diff the selection applies to both files, and --b-variant <name> and --b-set <knob>=<value> change b's alone; see diff. sweep takes all but --steps: --set pins a knob across every point (pinning an axis or row knob of the sweep exits 2), --variant applies when the sweep names no variant, --diagnostics applies to every point. rrun --sweep takes them the same way, and --steps for every point unless the sweep varies a knob steps. See knobs.

Flags

Each verb takes the flags its row and page name and no others. A flag starts with --, or is -o given to bundle; any other argument, -1 or - among them, is an operand, and only feedback reads - as standard input. -- alone ends the flags: every argument after it is an operand, sexpgpu fmt -- --odd.sx. A flag's value is the next argument, --set lr=0.1, never --set=lr=0.1, and a value cannot start with --. --set, --knob and --pass repeat; every other flag appears once. A command line that breaks any of this exits 2 with one line per problem.

sexpgpu docs search <words>... asks the documentation's search which pages best answer a question, the words joined by single spaces, and prints up to --limit N of them (1 to 20, 5 by default), best first: each page's title and markdown URL, then its best passage on one line, a blank line between pages.

$ sexpgpu docs search resume a preempted run --limit 1
Checkpoints and resume  https://sx.041.io/docs/checkpoints.md
  A run checkpoints to a location, and continues from its newest checkpoint with `--resume latest`. A signal stops it at a step boundary with a checkpoint of that step, so a preempted run loses nothing.

A passage longer than 240 characters is cut, ending in …. With no match it prints No pages match. and exits 0. --json prints the search's answer as one JSON object: query, site and hits, each hit with title, url (the page), markdownUrl, score (0 to 1) and snippets, the matching passages best first. A word that starts with -- goes after --. One address searches at most 30 times a minute.

Standard streams

Standard output carries a verb's answer: JSON, IR, formatted source, a table. Standard error carries what a run says while it works: diagnostics, progress, the timing block, the done: block. run keeps standard output free unless asked for data: --json puts the summary there, and --metrics stdout makes it the metrics stream. With both, the summary is the stream's last line.

Exit codes

The same for every verb:

codewhen
0it worked
1the thing failed: diagnostics (an unknown --variant or --set knob among them), a run that could not start or died, an evaluate refused by its checkpoint or asked for an undeclared pass, a fmt --check that would rewrite, a doctor that says a run cannot start (except its CUDA startup failure under exit 75), a bundle whose data is not on this machine or whose run would not read its bundled data, an rrun --sweep with a point that does not compile or that rrun did not take a job for, an update that could not read the release, found no binary for this platform, downloaded one whose SHA-256 does not match, could not write next to the binary, or found another update running, an rrun whose bundle, login, upload or job rrun refused, a feedback the endpoint refused or that could not reach it, and a docs search the search refused or that could not reach it
2the command line was wrong: an unknown verb, a missing or extra argument, an unknown flag (--flag=value among them), a flag given twice that does not repeat, a flag without its value, a probe without --expr or with a --max-elements that is not a positive whole number, an eval with neither a file nor --expr, an ir --model without --graph, a --set without =, a --steps or --eval-every that is not a whole number, an --evaluate other than inline or offline or one whose checkpoints are too coarse for a pass, a sweep the file does not declare or an --only that is not one of its points, a pinned sweep axis or row knob, a sweep --json without --dry-run, an rrun --only or rrun --dry-run without --sweep, an rrun --sweep of more than 1000 points or with a SEXPGPU_RESUME other than latest, an evaluate without --checkpoint or with a --poll that is not a positive number or a --from-step that is not a step number or latest, or without --follow, a --knob the file does not declare, a new or bundle target that exists, an rrun without one of --gpu and --cpu-only, with a number or duration it cannot read or an --urgency other than thrifty, balanced or urgent, or whose job would lack a location or key it needs (run on rrun), a new with neither or both of --from and --example, an --example the binary does not carry or whose data file exists with other bytes, an update --channel other than stable or nightly, a feedback message that is empty, longer than 20000 UTF-16 units, or not UTF-8, or its standard input over 1 MiB, a docs without search, or a docs search whose query is empty or longer than 500 UTF-16 units or whose --limit is not a whole number from 1 to 20
75run, sweep or evaluate could not start a required data loader, data manifest or checkpoint worker because the OS temporarily refused thread creation (EAGAIN). run, sweep or evaluate inside an rrun job when CUDA device initialization fails, or a typed CUDA driver error is CUDA_ERROR_ECC_UNCORRECTABLE (214), CUDA_ERROR_NVLINK_UNCORRECTABLE (220) or CUDA_ERROR_CONTAINED (226). rrun reports the host bad, deletes a cloud machine, excludes its provider host for seven days and restarts elsewhere up to three times in a row, outside --restarts even when it is zero. A contained exception can also follow invalid peer-memory access; this recovery policy does not prove faulty hardware. serve returns 75 inside rrun when CUDA device initialization fails before it serves; a CUDA error once serving exits 1. doctor returns 75 inside rrun only when its sole refusal is CUDA device initialization failed. Missing libraries, no exposed device, invalid selections and other later CUDA failures exit 1; outside rrun these device failures also exit 1
76run, sweep or evaluate exhausted transient storage recovery while reading training data or pretrained parameters, saving or restoring a checkpoint, or writing records. Storage requests retry for thirty minutes. Training data and pretrained reads reset their recovery window when bytes arrive. In an rrun job, rrun restarts the command within its restart budget without marking the machine bad. Missing objects, permission failures and invalid data exit 1
128 + nrun, sweep or evaluate stopped by signal n: 129 SIGHUP, 130 SIGINT, 143 SIGTERM. Any other verb whose standard output closes early, sexpgpu ir x.sx | head, ends by SIGPIPE, 141, as a Unix tool does; run, evaluate and sweep fail on the write instead, and run and sweep say so in their status file; a feedback whose report was recorded exits 0

Paths

A path inside a .sx file never depends on the working directory: a require resolves against the file that holds it, a loader path against the experiment file. Only paths on the command line are relative to where you are.

Related: environment, working as an agent.