/reactantnitro-jl:reactantnitro-acceleratorsfrom reactantnitro-jl
Configures the accelerator backend (CPU, CUDA, ROCm, TPU) and device count for ReactantNitro runs. Covers setup_devices!, the nitro_setup tool, n_devs pinning, and CUDA_VISIBLE_DEVICES for GPU restriction.
Ships in reactantnitro-jl. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A Julia process initializes its XLA/PJRT client once, at the first device access, and the client is then fixed for the process's lifetime. Everything in this page is a consequence of that fact:
n_devs never creates clients or processes. It slices the already-visible device set to
build the Sharding.Mesh; XLA partitions ONE compiled program over that mesh. There is
no MPI and no NCCL here, and n_devs = 4 is not "four training processes".set_default_backend swaps the pointer) but device
VISIBILITY is frozen: CUDA_VISIBLE_DEVICES must be set before the process starts.Reactant.devices()
returns one device, so a CPU session's n_devs is 1 and the mesh is skipped.One code path, two entry points: the framework function ReactantNitro.setup_devices!, and the
Kaimon tool nitro_setup, which is a thin wrapper over exactly that function. A REPL session
and a Kaimon session therefore configure identically.
REPL / a script (the non-Kaimon workflow):
using ReactantNitro
setup_devices!(backend = "cpu") # run everything on CPU
setup_devices!(backend = "cuda", n_devs = 2) # two of the visible CUDA devices
setup_devices!() # report what is in effect
backend passes through to Reactant.set_default_backend and names a Reactant backend:
"cpu", "gpu" (whichever of CUDA/ROCm is available), "cuda", "rocm", "tpu".
Kaimon (the tool form):
nitro_setup(backend = "cpu")
nitro_setup(backend = "cuda", n_devs = 2)
nitro_setup() # report
The tool returns a one-line report; the function returns (; backend, visible, n_devs, pinned).
Calling it is optional. A session that never calls it runs on Reactant's default backend
with n_devs = every visible device, length(Reactant.devices()), which is what a CPU
machine gets automatically. The setup call exists to be explicit and to fail fast: an unknown
backend or a device count larger than what is visible is a loud error, not a silent fallback.
If you are porting: your model may have run under a different framework where the backend was chosen per-run or per-process via environment or a config file. Here the backend is set at the process level before any run, and a run never re-selects it.
n_devs: what it is and what it is not:data axis of a
1-D mesh. 1 skips the mesh entirely.batch_size = 32 on four devices puts 8 samples on each, and
its numerics are those of a 32-sample batch, not a 128-sample one. Adding devices buys
throughput and does not change the effective batch.CUDA_VISIBLE_DEVICES.Dropout mask is one global mask split across devices. Every ReactantRNG is placed as
"PHILOX" at any device count, so a mesh run draws the same masks as a single-device run.setup_devices!(n_devs = k) (or nitro_setup(n_devs = k)) pins the count for the whole
process. Resolved order, highest wins:
n_devs keyword on Nitro / train! / nitro_train, for one runsetup_devices! / nitro_setupn_devs fieldlength(Reactant.devices()), every visible deviceSo a pinned session overrides what an experiment declares (the session operator's explicit choice beats the model author's default), and a per-run keyword overrides the pin. A batch that does not divide evenly across the mesh is a setup error naming both numbers.
CUDA_VISIBLE_DEVICESTo run on a subset of the GPUs on a host, set CUDA_VISIBLE_DEVICES before starting the
process (in the shell, the job script, or the session launcher); visibility is fixed at the
first XLA client access and cannot be changed mid-process. n_devs can then only select within
what is visible, and asking for more than is visible is an error that names the variable:
ReactantNitro: `n_devs = 4` but Reactant sees 2 device(s).
`n_devs` counts LOCAL, VISIBLE devices and the default is all of them, so this is either a
hand-set value that is too large or a `CUDA_VISIBLE_DEVICES` narrower than you meant.
The same rule applies at the Reactant level: Reactant.devices() is what the process can see,
and it is fixed once the client exists.
setup_devices!() / nitro_setup() with no arguments change nothing and report: the backend
in use (Reactant.XLA.platform_name(Reactant.XLA.default_backend())), how many devices are
visible, and the n_devs the next run will use, plus whether it is pinned or the default.
For the underlying library's full platform matrix (driver versions, detection, disabling GPU support), the Reactant documentation's configuration page is the reference; the framework does not restate it.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
11 skills in this plugin
/reactantnitro-checkpoint-resumeCheckpoint and resume a ReactantNitro run: `Checkpointer(; keep)` and its selectors (`Best`, `Last`, `Epochs`, `Every`; retention is their union), `scope = :run | :dir`, current-metric-only selection, the deprecated `TopKCheckpointer`, the `run => checkpoint` source grammar shared by `weights` and `resume`, checkpoint averaging (`Average`, `Best(k; among)`, `average_checkpoints`, `averaged_from`), `resume = :auto`, `restore_optimizer`, `restore_best` (including `restore_best = Average(...)`), finding run ids with `runs()` and `checkpoint_run()`, what a checkpoint record holds and why every value in it is a host value, the four refusals behind a resume, and what is recomputed rather than restored. Invoke when configuring checkpointing, resuming or continuing a run, debugging a refused or failed resume, or deciding which artifact to load for evaluation or export, or configuring an early stop.
/reactantnitro-device-boundaryDebug and prevent CPU/GPU divergence in ReactantNitro: why a fully green CPU test suite can pass while code has never once worked on a device, what a model author must and must not do at the boundary, what scalar indexing does differently on each backend, how to read a residency assertion, and the rule to apply to any new contract ("would this raise on CPU?"). Invoke when code that passes on CPU fails on a GPU; when anything raises "Scalar indexing is disallowed" or "still holds DEVICE-resident values"; when a resume dies on `buffer.buffer !== C_NULL`; or when adding a contract that promises host or device residency.
/reactantnitro-experimentAuthor or read a ReactantNitro experiment: the four required hooks, the three field markers (Device, Host, GraphConst) and which one a field wants, why every knob is a FLAT field and never a configuration struct held in one, the batch contract and keyword routing, what a hook may return and why a batch-reduced scalar may not be an output leaf, derived values, and what `Nitro(e)` does. Also the canonical model shape (one `@compact`, the experiment passed in by `forward`, never captured) and the rule for `@trace` loops that read the experiment or a captured activation (`track_numbers = false`). Start here for any ReactantNitro task; this skill also indexes the rest. Invoke when writing a new experiment or model, porting a training loop onto ReactantNitro, adding a knob to an existing one, writing a `@trace` loop, or reading one you did not write.
/reactantnitro-exportExport a trained ReactantNitro model to a servable artifact: the six export hooks and which are optional, why the exported graph is not the graph that trained, the wire convention, what the framework derives and verifies versus what you declare, and what provenance it stamps versus what you must supply. Invoke when exporting a model, writing the export hooks for a new experiment, or reading a bundle that does not behave the way its manifest says it should.
/reactantnitro-kaimonDrive ReactantNitro runs from a Kaimon-hosted session: the `nitro_*` GateTools the KaimonGate extension registers (train, validate, evaluate, predict, export, runs, status, stop), when the tools appear, why every tool returns immediately and the run runs in the background, how to name an experiment and split run knobs from experiment fields, and how the tools map to the framework verbs `train!`, `validate`, `evaluate`, `predict`, and `export_model`. Invoke whenever a session is hosted by Kaimon, when a workflow says "train the model", or when writing a harness-specific skill that will assume the tool surface.
/reactantnitro-manualTrain a ReactantNitro experiment in manual mode, where the experiment owns the whole optimizer step: `train_step` and how defining it selects the mode, `setup_optimizers`, the checked return contract, `backward` with the objective discipline (a closure capture of a traced value silently zeroes the gradient), `step_optimizer`, path-bound `opt` schedules, and what the automatic loop still does for you. Invoke when the automatic loop cannot express an algorithm, the canonical case being a GAN with two optimizers, or when reading or writing a `train_step`.
npx claudepluginhub enzymead/reactantnitro.jl --plugin reactantnitro-jlOther plugins' skills for the same job