All pages
bundle and remote runs
sexpgpu bundle writes one directory that runs the experiment on any machine
the binary runs on: the binary, every source the compile read, every local file
the loaders and :load parameters read, and a run.sh with the selection baked
in. The other machine needs only the environment, and for SEXPGPU_DEVICE=cuda
the CUDA requirements, for SEXPGPU_DEVICE=rocm
the ROCm ones.
sexpgpu bundle my-run.sx -o out/my-run --binary ./sexpgpu-linux-cuda
scp -r out/my-run gpu-box:
ssh gpu-box 'SEXPGPU_DEVICE=cuda SEXPGPU_METRICS=jsonl:my-run/metrics.jsonl \
SEXPGPU_STATUS=my-run/status.json \
SEXPGPU_CHECKPOINT_DIR=s3://my-bucket/runs/my-run my-run/run.sh --resume latest'| flag | meaning |
|---|---|
-o <dir> | where to write; a directory that exists is refused (exit 2) |
--binary <path> | the binary to pack instead of this one, e.g. the Linux binary packed from a Mac |
--variant, --set, --steps, --eval-every, --diagnostics | baked into run.sh |
--checkpoint <location>/step-<n> | bundle the evaluation of that one checkpoint instead, under the selection it records; see below |
--metrics-slug <slug> | with --checkpoint, bake an independent evaluation identity into the bundle |
--pass <name> | with --checkpoint, only this evaluation pass; repeatable, every pass by default |
$ sexpgpu bundle my-run.sx -o /tmp/my-run --steps 100
wrote /tmp/my-run: 3 source files and 2 data files, 10.8 MiB; binary /usr/local/bin/sexpgpu (20.0 MiB, without CUDA: SEXPGPU_DEVICE=cuda would refuse)
run it: /tmp/my-run/run.sh [run flags], with SEXPGPU_* in the environmentWithout --binary a bundle packs the build that writes it. Write a bundle for
AMD GPUs with SEXPGPU_DEVICE=rocm set, so that sexpgpu hands bundle to the
ROCm build and the wrote line ends the ROCm build), or pack the ROCm build
with --binary.
Bundle fixed-checkpoint evaluation
sexpgpu bundle my-evaluation.sx -o out/evaluation --binary ./sexpgpu-linux-cuda \
--checkpoint s3://my-bucket/runs/my-run/step-00000300 --pass probe \
--set search=true --metrics-slug my-search-evaluationThe bundler reads the checkpoint's experiment.json with the credentials of its
location and compiles the source under the
checkpoint's variant, knobs and runtime overrides, as
evaluate does. So --checkpoint takes -o,
--binary, --pass, --metrics-slug, and repeatable --set and
--drop-recorded-knob only; --variant, --diagnostics, --steps and
--eval-every are unknown flags with it (exit 2). Each --set applies after
the recorded selection, using the same rules as evaluate: parameter names,
shapes, dtypes and training or buffer roles must match, and recorded runtime
overrides stay fixed. The bundler checks this before writing the bundle;
evaluate checks again before loading weights. Edited sources are allowed.
The checkpoint must be one in object storage, s3://, gs://, az:// or
o41://, ending in step-<n>: not latest, a location to follow, or a local
directory. It stays where it is. The bundle carries the selected passes' local
data and :load files, not the training data, and evaluation.json records the
checkpoint URI, Metrics slug and passes. run.sh runs sexpgpu evaluate on
that URI and those passes with the bundle's data map, and
writes no training checkpoint. The environment selects the device, Metrics
target and credentials. A retry evaluates the same weights; completed passes may
report again.
Explicit knob overrides are baked into run.sh. A data path changed by --set
is bundled and relocated along with the selected passes' other local data.
An evaluation bundle accepts --metrics-slug <slug> to bake an
isolated reread into its run.sh. Its
evaluation.json receipt records the evaluation slug and source_run; without
that flag it retains the training slug. The same flag can be passed when running
an existing evaluation bundle.
Layout
/tmp/my-run/sexpgpu the binary
/tmp/my-run/run.sh exec sexpgpu run files/my-run.sx --steps 100 --data-map ../data-map.json "$@"
/tmp/my-run/data-map.json each local data path string moved, the file's to the bundle's
/tmp/my-run/files/my-run.sx the run, at the top under its own name
/tmp/my-run/files/deps/mine-5745a31f.sx every required file, flat
/tmp/my-run/files/deps/blocks-e6e29e73.sx
/tmp/my-run/files/deps/lib/layers-0c41d2b8.sx every required file under a `lib` directory
/tmp/my-run/files/data/train.parquet local loader and :load files
/tmp/my-run/files/data/val.parquet-
A dep is
<stem>-<hash>.sx, the hash covering its path and its text, so two different modules never share a name or bindings, even with identical text. -
A dep that was under a directory called
libgoes indeps/lib/, so it stays library code: an error or a guard made there points at the researcher's call, as it does before the bundle. -
Data keeps its layout under its deepest common directory. A local
:loadorwith-loadedfile is data, and an.index.jsonbrings every shard it names, which stay beside it. -
Every
require, loader,:loadandwith-loadedpath, including one given with--set, is rewritten to where the file now is:(require "./deps/blocks-e6e29e73.sx" ...). Arequireis written from the file that holds it; every other path, in a dep too, from the run at the top offiles/, since it resolves against the experiment file::load ["./data/weights/w.safetensors" "w"]. A training bundle'srun.shlists where each dep came from. A bundled run's setup names the bundle's paths and hashes, its knobs the original paths; see the data map. -
A string naming a directory the data lies under is rewritten too, so a run that binds
(defvar data-dir "../data/")and builds(str data-dir "train-" i ".parquet")bundles. A path computed from anything else,(str "../data/train-" i ".parquet"), cannot be rewritten: the bundle compiles the rewritten run with the baked selection and refuses (exit1, removing what it wrote) when a loader would read anything but a file underfiles/. Write the directory as its own string, or read the data from ans3://URI. -
Standard modules are in the binary and not copied.
s3://loader and:loadfiles are read on the other machine with its credentials. A local loader file,:loadfile or shard missing here fails the bundle (exit1), naming the parameter for a:load:sexpgpu bundle: model.teacher.q loads weights/model.safetensors.index.json, which needs /home/me/runs/weights/model-00002-of-00002.safetensors, not on this machine; bundle it here, or load it from an s3:// URI
The data map
data-map.json maps each local data path string the bundle rewrote, in the
sources or a --set, as the file wrote it, to the string that names it in the
bundle: {"../data/eval.jsonl.gz": "./data/eval.jsonl.gz"}. run.sh passes it
as --data-map. With it a training run records each knob value naming moved
data as the file wrote it, in the checkpoint's experiment.json and in the
Metrics experiment, under the slug the file gets. So a bundled run's checkpoint
evaluates from the original file with
evaluate or bundle --checkpoint, and a
resume of the bundle sees no change. An evaluation bundle moves the checkpoint's
knob values the other way.
A knob value the run builds from a moved directory,
(str data-dir "eval.jsonl.gz"), changes with it, so the map also holds each
knob value that differs between the original and the bundled compile, whole.
Only strings the map names move; another string that merely starts like a
bundled path is left as it is. A file the sources spell two ways, data/x and
./data/x, is recorded under one of the spellings; both name the same file from
the original.
run.sh
run.sh passes its own arguments through: ./run.sh --resume latest starts the
run the first time and continues it every time after, and
./run.sh --eval-every 50 changes the cadence. Set SEXPGPU_DEVICE,
SEXPGPU_METRICS, SEXPGPU_CHECKPOINT_DIR and credentials in the machine's
environment, never in the bundle. See environment. The bundled
binary updates itself after a command finishes,
as an installed one does, unless the machine sets SEXPGPU_AUTO_UPDATE=0 or
O41_AUTO_UPDATE=0.
Running remotely
Whatever runs the process (ssh with nohup, a job runner, a scheduler) also
stops it, restarts it and keeps its log. With SEXPGPU_STATUS set the run
leaves a status file saying where it is. Put --resume latest on
the command line from the first launch: the first time there is no checkpoint
and the run starts fresh; every restart continues from the newest one.
With the binary and the sources already on the machine, no bundle is needed:
sexpgpu run my-run.sx --device cuda --metrics o41:<folder-id> \
--checkpoint-dir o41://my-team/my-run --resume latestRun on rrun
rrun by 041 runs a folder's command on the cheapest GPU
that fits, across your cloud accounts, streams its logs back and runs it again
on another machine when a spot machine is taken. A bundle is that folder, and
sexpgpu rrun writes it and launches it as an rrun job:
sexpgpu rrun my-run.sx --gpu A100,H100 --spot \
--metrics o41:<folder-id> --checkpoint-dir o41://my-team/my-runsexpgpu rrun: my-run: 6 files, 11.4 MiB gzipped, uploaded
j-8kq2m4x7pa queued. Follow: o41-rrun logs j-8kq2m4x7pa -fIt prints the job's id and returns. The job is rrun's from there:
o41-rrun logs <id> -f follows it, o41-rrun wait <id> waits for its end and
o41-rrun cancel <id> stops it. The bundle carries the Linux x86-64 binary of
the version you run, the CUDA build or, for AMD GPUs, the ROCm build: this one
when it is that build and otherwise the same release, downloaded once and kept
in ~/.cache/sexpgpu/linux-x86_64 or ~/.cache/sexpgpu/linux-x86_64-rocm; its
checksum is verified before each job takes it. The job is named after the run's
slug, and a bundle rrun already holds is not uploaded
again.
| flag | meaning |
|---|---|
--gpu <choices> or --cpu-only | one of the two: any one of MODEL or MODEL:N GPUs, comma separated (A100,H100:8), or a machine without one; the run gets SEXPGPU_DEVICE cuda, rocm for AMD models, or cpu |
--metrics <target>, --checkpoint-dir <location> | as for run, over SEXPGPU_METRICS and SEXPGPU_CHECKPOINT_DIR |
--variant, --set, --steps, --eval-every, --diagnostics | baked into run.sh, as bundle does |
--binary <path> | the Linux x86-64 binary to send instead, the ROCm build for AMD GPUs |
--json | print {jobId, status, slug, bundleSha256, uploaded} instead |
--sweep <name>, --only <points>, --dry-run | every point of a declared sweep as its own job, from one bundle; see a sweep on rrun |
--grade-checkpoints <file.json> | run external grading shards and a merge for each committed checkpoint of one training run |
--spot, --ram, --cpus, --vram, --disk, --cloud, --max-price, --cuda, --image, --timeout, --keep, --queue, --queue-name, --deadline, --restarts, --urgency, --reserved-only, --cloud-only | o41-rrun run's, sent to rrun as given, with its defaults; see its docs |
--warn-slow enables throughput warnings for one GPU on one node. SexpGPU
reports training windows to rrun, excluding evaluation, checkpointing and input
waits. After five minutes of training warmup, two consecutive 15-minute training
windows with at least 30 steps each warn when their median step times are at
least 3x a reference. Check o41-rrun status <job> and o41-rrun events <job>.
Warnings leave the job running and do not establish a hardware fault.
The automatic reference comes from an earlier attempt of the same job with
matching workload, phase, curriculum stage and GPU configuration. Without one,
status says it is waiting for a reference. --step-target <seconds> with
--warn-slow sets your explicit training-seconds-per-step reference, including
for comparisons across GPU models; a --step-target without --warn-slow, or
one that is not a finite positive number, is refused with exit 2. Missing
progress or unsupported configurations are reported as such, rather than treated
as healthy training.
--urgency thrifty|balanced|urgent says how rrun weighs waiting against price
when it picks the machine; without it the job takes its queue's urgency. Any
other value exits 2.
--priority expedited gives each submitted job a temporary head start within
its rrun queue.
--nodes <n>, 1 to 16, runs the job on n machines at once, each a machine the
flags above describe, as one run across them
(several nodes): every node's run is told the node
count, its own node and node 0's address. It needs --gpu, and rrun's own rules
for such jobs hold: see o41-rrun run --help.
An NVIDIA GPU job runs in nvidia/cuda:13.0.3-cudnn-runtime-ubuntu24.04 on the
clouds that run containers, on a machine whose driver runs CUDA 13
(--cuda 13.0); --image names another image and sets no CUDA version of its
own. A job with an image never takes your reserved machines, so
--reserved-only sends none.
An AMD model in --gpu, such as MI250X or MI300X, makes an AMD job: it runs
the ROCm build with SEXPGPU_DEVICE=rocm, on the cloud's own ROCm image or a
reserved machine's installed ROCm, which must hold the
ROCm libraries. --image and --cuda are refused
for it, and so is a --gpu that names NVIDIA and AMD models together, since one
job runs one build.
sexpgpu rrun my-run.sx --gpu MI300X \
--metrics o41:<folder-id> --checkpoint-dir o41://my-team/my-runrrun runs a job again on another machine when its machine is lost or taken back,
up to --restarts times, and the run continues from its newest checkpoint. So
the job needs --checkpoint-dir in object storage (s3://, gs://, az:// or
o41://), or --restarts 0. Every attempt runs with SEXPGPU_RESUME=latest,
which starts the run the first time and continues it after. A
SEXPGPU_RESUME=<location>/step-<n> set here goes to every attempt instead: the
first forks that checkpoint, and a restart continues the newest checkpoint the
fork wrote (resume). Each attempt is an
rrun job <id> attempt <n> annotation in the run's
metrics.
The job is sent the run's settings and only the keys its own locations need, each under the name it is set by here. rrun keeps the sealed ones encrypted, never shows them back and deletes them when the job ends; the rented machine still reads them in the run's environment.
- Always
SEXPGPU_DEVICE, and those ofSEXPGPU_RUN_SLUG,SEXPGPU_TIME_LIMIT,SEXPGPU_FINAL_EVAL_RESERVE,SEXPGPU_DIAGNOSTICS,SEXPGPU_CHOICES,SEXPGPU_DETERMINISTIC,SEXPGPU_NODE_GRADIENTS,SEXPGPU_EVAL_LIMIT,SEXPGPU_MEMORY,SEXPGPU_EXPLAIN,SEXPGPU_ANALYTICS,SEXPGPU_PERFORMANCE_REPORTS,DO_NOT_TRACK,SEXPGPU_AUTO_UPDATEandO41_AUTO_UPDATEthat are set. With neither update switch at0, the job's binary updates itself after its command, as an installed one does. - A metrics target as
SEXPGPU_METRICS; foro41,O41_METRICS_API_KEYsealed, and for a bareo41itsO41_METRICS_FOLDER_ID.stdoutputs the events in the job's log; ajsonl:file would stay on the rented machine and is refused. - A checkpoint location as
SEXPGPU_CHECKPOINT_DIR, withSEXPGPU_RESUME. - For an
o41://location, of the checkpoints,SEXPGPU_RESUMEorSEXPGPU_CHOICES:O41_ARTIFACTS_API_KEYsealed andO41_ARTIFACTS_ORG. - For an
s3://location, the checkpoint role's four S3 values, and for a run that readss3://data, the data role's; the access key id and the secret key sealed. - A
gs://oraz://location is read with the machine's own credentials: none are sent.
No other key set here goes, and nothing that describes this machine
(SEXPGPU_DEVICES, SEXPGPU_STATUS, O41_ARTIFACTS_CLOUD, ...). A
SEXPGPU_RESUME or SEXPGPU_CHOICES that names a file on this machine is
refused, since the job cannot read it.
sexpgpu rrun signs in as o41-rrun does, with its saved login (refreshed when
it is about to expire) or O41_RRUN_API_KEY; O41_RRUN_ORG picks the
organization. rrun first needs o41-rrun login and one connected cloud account;
see getting started. The job copies
the bundle to /tmp/sexpgpu-bundle and runs ./run.sh there: a run records the
local data files it reads by absolute path in every checkpoint, so every
attempt, and every later job continuing the run, finds them at that path. On
GCP, AWS, Verda, Nebius and DigitalOcean a CUDA job first installs the CUDA 13
cuBLAS, NVRTC and cuDNN libraries (and NCCL, for several GPUs) the machine lacks
from NVIDIA's package repository, which needs Ubuntu 22.04 or 24.04.
sexpgpu rrun exits 0 once the job is queued, 2 for a command line it
refuses, before anything is built, and 1 when the bundle, the login, the
upload or rrun fails.
Grade checkpoints with an external program
Pass a grading specification when launching one run that saves to 041 Artifacts.
Set O41_RRUN_API_KEY and O41_ARTIFACTS_API_KEY in the launching environment.
sexpgpu rrun my-run.sx --gpu H100 --spot \
--checkpoint-dir o41://my-team/my-run --grade-checkpoints grade.json \
--secret O41_ARTIFACTS_API_KEY --secret O41_METRICS_API_KEY{
"directory": "./grader",
"coordinatorQueue": "checkpoint-grading",
"shards": 4,
"maxCheckpoints": 20,
"shard": {
"command": "./grade-shard",
"resources": { "gpus": [{ "model": "L4", "count": 1 }], "spot": true },
"timeoutSeconds": 3600
},
"merge": { "command": "./merge-grades", "timeoutSeconds": 900 }
}directory must be a relative path within the JSON file's directory. rrun
uploads that directory once and runs both commands from it. Include executables
and their inputs in the directory or have the commands fetch them. resources
uses rrun's job resources. Omitted resources
request a CPU, and minDiskGb defaults to 50. The merge takes CPU resources.
Both templates also accept image, env, queueName, queueSeconds,
placement, and restarts. The training queue is the default for both. Repeat
--secret NAME on the launch command to send selected environment values sealed
to both grader commands. Include the Artifacts key when the grader reads the
checkpoint directly from Artifacts. With --secret, each shard and merge
attempt runs on a freshly launched cloud machine. Leave placement out or set
it to "fresh" in both templates.
Both commands receive O41_CHECKPOINT with the exact version path,
O41_GRADING_JOB with the coordinator's job ID, and O41_SHARD_COUNT. Each
shard receives its zero-based O41_SHARD_INDEX. Write the shard's output to
durable storage before exiting successfully. The merge receives
O41_SHARD_JOBS, a JSON array of shard job IDs in index order.
The launch prints the CPU coordinator's job ID. With --json, it returns
{jobId, status, role: "grading", slug}. Follow the coordinator's logs to see
the training, shard and merge job IDs. The coordinator runs in
coordinatorQueue (default checkpoint-grading) and uses a CPU slot while the
workflow is active. It requires an rrun server with fresh placement and starts
each attempt on a newly launched cloud machine. Its rrun API key stays on that
job.
The coordinator submits training and grades retained SexpGPU checkpoints at that
location, including versions already there. Set maxCheckpoints to the maximum
number of checkpoints this workflow may grade. Each checkpoint can create
shards jobs and one merge. The coordinator fails if the catalog exceeds the
limit. Keep the checkpoints through grading so a restarted coordinator can
recover the same child jobs. A fresh launch starts a new workflow. After
training ends, the coordinator checks for the final commits.
The merge starts after every shard succeeds. A retryable attempt, including a
bad-host exit 75, keeps the shard pending until rrun records a final outcome.
A shard's terminal failure or cancellation skips that checkpoint's merge and
appears in the coordinator's logs. Other checkpoints continue. The coordinator
fails if training fails, a merge is skipped, or a merge job fails or is
cancelled. Cancel already submitted jobs by their individual IDs.
A sweep on rrun
--sweep <name> launches every point of a declared
defsweep as its own job, from one bundle that is packed
and uploaded once:
sexpgpu rrun my-run.sx --sweep lr-scan --gpu L4,A10G --spot --queue none \
--metrics o41:<folder-id> --checkpoint-dir o41://my-team/lr-scansexpgpu rrun: `lr-scan`: 3 points in one bundle of 6 files, 11.4 MiB gzipped, uploaded
0 lr=0.5 my-run-lr=0.5 j-8kq2m4x7pa queued
1 lr=0.25 my-run-lr=0.25 j-2c9xw61hrd queued
2 lr=0.125 my-run-lr=0.125 j-v0m3n7tq5e queued
sexpgpu rrun: 3 jobs queued. Follow: o41-rrun ls --activeEach job runs one point on its own machine, and rrun starts as many at once as
the queue's budget allows; give --queue none or a --deadline so the points
that wait for the budget do not give up after --queue's 30 minutes. Every
machine and job flag above describes each job: --gpu MODEL:N gives each point
N GPUs, --nodes each point that many machines, --cpu-only each point a
machine without a GPU. The point lines go to standard output, in point order:
the point, its explicit knob values, its slug and its job. The rest goes to
standard error.
| flag | meaning |
|---|---|
--sweep <name> | the declared sweep to launch; one the file does not declare exits 2 |
--only <points> | launch only these points: 3, 0,4 or 2-5, as sweep --only takes them |
--dry-run | print each point with its slug and its checkpoint location, and submit nothing: no login, no upload |
--json | print one object instead of the point lines; see below |
--set k=v | pin a knob for every point; pinning an axis or a knob used by any row exits 2, as for sweep |
--variant V | the base variant, when the sweep names none |
--steps N | the length of every point; exits 2 when the sweep varies a knob steps |
--eval-every N | the evaluation cadence of every point |
--diagnostics G | the diagnostics selection of every point |
- A point is a run of its own. It reports under its own
slug, so with an
o41metrics target each point is its own experiment, and it checkpoints in its own location: the checkpoint location with the point's slug appended, exactly wheresweepputs it. A restart after a lost machine continues that point's newest checkpoint and no other's. With a checkpoint location, every attempt runs withSEXPGPU_RESUME=latest; any otherSEXPGPU_RESUMEexits2. - Every point compiles before anything is sent, including the points
--onlyleaves out. The first that does not compile stops the launch withpoint 2 of `lr-scan` does not compileand its diagnostics, exit1. A point whose knob value does not read back as itself, a function or a NaN, cannot be passed to a job and stops it the same way. Two points whose knobs resolve to the same values would be one run and are refused. - One bundle holds what every point of the sweep reads, the local data and
:loadfiles of each, whichever points--onlynames: a point launched alone later runs from the same bundle layout its checkpoints recorded. Itsrun.shbakes--steps,--eval-everyand--diagnosticsand no point's selection; each job's command passes its point's--variantand--setto it, and ends in a comment that names the launch. A data path a--setor an axis names is rewritten to the bundle's, as the data map describes. One file that two points name by two spellings,data/xand./data/x, is refused (exit1): a point's slug would name the other spelling. - A sweep of more than 1000 points is refused (exit
2): declare it as several sweeps. A point whose selection makes a job command over 16 KiB, or ano41://checkpoint location over 512 characters, stops the launch before the upload.
Launching a sweep again
rrun holds at most one job that has not ended for a point. A point is its slug
with its checkpoint location, or without checkpoints its slug with its metrics
target, so the same sweep launched again under the same SEXPGPU_RUN_SLUG and
location, by this command or by another one at the same moment, never starts a
second job for a point that is queued or running. That point's line ends
launched earlier, and its job stays as it is, with the sources and the machine
flags it was launched with; cancel it first to change them.
0 lr=0.5 my-run-lr=0.5 j-8kq2m4x7pa running, launched earlier
1 lr=0.25 my-run-lr=0.25 j-r7d2k9s4mb queued
2 lr=0.125 my-run-lr=0.125 j-v0m3n7tq5e running, launched earlier
sexpgpu rrun: 1 job queued; 2 points already had a job that has not ended, left as it is. Follow: o41-rrun ls --activeA point whose last job ended, finished, failed or cancelled, gets a new job,
which continues the point from its newest checkpoint. So one command starts a
sweep, finishes a launch that failed midway and continues a cancelled sweep.
Name the points with --only to leave the finished ones alone.
When rrun refuses a job or cannot be reached, the jobs already being created
finish, no further one is sent, and the launch exits 1:
0 lr=0.5 my-run-lr=0.5 j-8kq2m4x7pa queued
1 lr=0.25 my-run-lr=0.25 not launched: /jobs: rrun answered HTTP 400: ...
2 lr=0.125 my-run-lr=0.125 not launched
sexpgpu rrun: 2 points of `lr-scan` not launched: /jobs: rrun answered HTTP 400: ...
1 job queued. Launch the rest with the same command and `--only 1-2`, under the same SEXPGPU_RUN_SLUG: a point whose job has not ended is never launched twice.The JSON answer
--json prints one object on standard output: sweep, points (how many the
sweep has), bundleSha256 and uploaded, and jobs, one object for each
launched point in point order:
| field | meaning |
|---|---|
point | zero-based declaration index, as --only takes it |
slug | the point's run slug |
selection | the --variant and --set arguments that select the point |
checkpointDir | the point's checkpoint location, or null without one |
jobId | the point's job, or null when it has none |
status | the job's status as rrun reports it |
created | true when this launch created the job, false when the point already had one |
error | why the point has no job; present instead of status and created |
With --dry-run the object has dryRun: true in place of bundleSha256 and
uploaded, and its jobs have point, slug, selection and checkpointDir
alone.
By hand
o41-rrun run launches a bundle too. Write it outside any git work tree, here
under ~/.sexpgpu/bundles: in a work tree rrun packs only what git would track,
and a bundle is usually ignored. On a Mac, install the Linux binary of the same
release beside your own and pack it:
curl -fsSL https://sx.041.io/install.sh | SEXPGPU_PLATFORM=linux-x86_64 \
SEXPGPU_VERSION=$(sexpgpu --version | cut -d' ' -f2) \
SEXPGPU_INSTALL_DIR="$HOME/.sexpgpu/linux-x86_64" sh
sexpgpu bundle my-run.sx -o ~/.sexpgpu/bundles/my-run \
--binary ~/.sexpgpu/linux-x86_64/sexpgpu
cd ~/.sexpgpu/bundles/my-run
o41-rrun run --gpu A100,H100 --spot --cuda 13.0 \
--image nvidia/cuda:13.0.3-cudnn-runtime-ubuntu24.04 \
--env SEXPGPU_DEVICE=cuda --env SEXPGPU_METRICS=o41:<folder-id> \
--env SEXPGPU_CHECKPOINT_DIR=o41://my-team/my-run \
--secret O41_ARTIFACTS_API_KEY --secret O41_METRICS_API_KEY \
-f -- 'cp -a . /tmp/my-run && cd /tmp/my-run && exec ./run.sh --resume latest'--cuda 13.0takes only machines whose driver runs CUDA 13. On Vast and RunPod,--imagebrings CUDA 13's cuBLAS, NVRTC and cuDNN, so nothing installs at start; the VM clouds ignore it and run their own CUDA images.sexpgpu doctornames a missing library, and a run over several GPUs also needs NCCL; see CUDA libraries.- For AMD GPUs, install
SEXPGPU_PLATFORM=linux-x86_64-rocm, the ROCm build alone, and pack that; give--env SEXPGPU_DEVICE=rocmand neither--cudanor--image. - rrun first needs
o41-rrun loginand one connected cloud account; see getting started. --secret KcopiesKfrom your environment, sealed. Keys never go in the bundle.-fstreams the run's log and exits with its exit code. Without it the command prints the job's id and returns;o41-rrun logs <id> -ffollows it later.- When the cloud takes the machine back, rrun runs the command again elsewhere,
and the run continues from its newest checkpoint in the same metrics
experiment; see preemptible jobs. The checkpoint location
must outlive the machine:
o41://or a bucket, never local. - The command copies the bundle to one fixed directory before
./run.sh: a run records the local data files it reads by absolute path in every checkpoint, so a resume must find them at the same path, and each machine unpacks the job somewhere else. - rrun uploads at most 95 MiB gzipped. Read larger data from an
s3://URI rather than bundling it.
The rest of rrun, from connecting a cloud account to choosing machines, is in its docs.
Preemptible jobs
A bundle is what a job runner starts again after a preemption, as the
rrun job above does. The recommended checkpoint location is
o41://<artifact> with O41_ARTIFACTS_API_KEY: the job can come back in any
cloud, each checkpoint lands in your bucket nearest it, and on o41:// a resume
fences the machine it left (a directory or a raw bucket has no fence; see
checkpoints).
A raw bucket works the same way with its own keys:
SEXPGPU_CHECKPOINT_DIR=s3://my-bucket/runs/my-run and the secrets
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (with AWS_ENDPOINT_URL and
AWS_REGION as --env); see S3 credentials.
Its checkpoints stay in that one region whichever cloud the job comes back in,
and nothing stops the machine it left from writing on.
When a spot machine is taken back or a machine is lost, rrun runs the command
again on another machine, up to --restarts times, and the run continues from
its newest checkpoint in the same metrics experiment, with resumed from <path>
marking the seam. The checkpoint location must outlive the machine, so it is
o41:// or a bucket, never local. A VM that gets a shutdown notice sends the
run SIGTERM: it checkpoints the step and exits 143, and
interrupted by SIGTERM at step <n> comes before the seam. A checkpoint larger
than the notice allows (a GCP spot VM gets thirty seconds) is cut off and passed
over for the one before it; the checkpoint annotation's seconds says how
long a run's checkpoints take. A machine taken without a notice the run sees is
a hard kill, and the steps after the last checkpoint run again. See
checkpoints.
Reading a preempted run
Open the experiment: its annotations, in the order they arrived, tell the whole story. A job whose spot VM was stopped 80 s into training:
- experiment opened
0 lowering: cuda compute_80 NVIDIA A100-SXM4-40GB, patterns on
34 interrupted by SIGTERM at step 34
34 checkpoint o41://.../step-00000034 in gcp us-central1 (region match) (8.349 s)
- experiment opened
34 resumed from o41://.../step-00000034
34 lowering: cuda compute_80 NVIDIA A100-SXM4-40GB, patterns on
60 checkpoint o41://.../step-00000060 in gcp us-central1 (region match) (8.411 s)Each process opens the experiment once. The lowering block names the machine a
process ran on, so a job that comes back in another zone or on another GPU says
so at the step it resumed. A checkpoint at the same step as interrupted says
the interrupting checkpoint fit the notice, and nothing is repeated. A
resumed from with no interrupted before it was a hard kill, and the steps
after the last checkpoint appear twice. The annotations are in the
events table; the o41-metrics-api Python package
reads them.