Skip to content
Opod

Core CLI

opod shard

Create, list and remove gangs (one model split across several workers), run several gangs of one model, and read the errors a create returns.

In short

opod shard splits a model that is too big for one worker into a gang across several, and removes it again. With no count it picks the number of parts from the workers' free memory. It calls the running leader.

opod shard create llama-3.3-70b-sharded --nodes n_a,n_b
▶ creating sharded model llama-3.3-70b-sharded on [n_a n_b] (this may take a few minutes)…
✔ sharded model ready: llama-3.3-70b-sharded

Usage

opod shard create MODEL [N] [--nodes a,b,c] [--tp N] [--pp N] [--gang ID]
opod shard ls
opod shard remove MODEL [--gang ID] [--yes]

A gang is one copy of a model split into parts across workers: a coordinator that serves requests and the parts it drives. A model may have several gangs; each serves whole requests, and the router picks the least loaded ready one. In core v0.4.6 that choice is load alone: a conversation's pin, the prefix pin and the route token are not read for a gang. From core v0.4.7 gangs are ranked like workers: a later turn of a conversation, or a prompt whose lead a gang served, stays on that gang while it has a free slot. See Sharding and gangs for the backends and their rules.

All three commands call the running leader's admin API, with the key in ~/.opod/admin.key, at http://localhost<listen>. With no leader they fail with opod: admin call: … (is opod up running?); from core v0.4.6 the message names the address, where it came from and the fix (no leader answering at … — start it with opod up, or set OPOD_BASE_URL), and OPOD_BASE_URL / OPOD_TOKEN reach a leader on another host (Where commands act).

Sub-commandAliasAdmin route
create—POST /admin/v1/shards/create
lslistGET /admin/v1/shards
removermDELETE /admin/v1/shards/{model} or …/{model}/{gang}

opod shard create

Argument / flagDefaultEffect
MODEL— (required)A catalog id. The entry's sharding.engine picks the backend: llamacpp (RPC parts), vllm (Ray, or expert parallel), sglang (its own launcher).
Npicked (below)The number of parts, 1 or more. 1 runs the whole model on one worker with no split.
--nodes a,b,cpickedPut the parts on these workers, in this order. Node ids from opod node ls.
--tp N0 (not set)Tensor-parallel size. vLLM and SGLang only.
--pp N0 (not set)Pipeline-parallel size. vLLM and SGLang only; pipeline is vLLM's default.
--gang IDnoneBuild this gang only; the model's other gangs keep serving. Without it, the create replaces every gang of the model.

Each flag also takes the --flag=value form.

opod shard create llama-3.3-70b-sharded                       # the CLI picks the count
opod shard create llama-3.3-70b-sharded 2                     # 2 parts on picked workers
opod shard create llama-3.3-70b-sharded --nodes n_a,n_b
opod shard create llama-3.3-70b-sharded --nodes n_a           # N=1: whole model on n_a
opod shard create mimo-7b-ray --nodes n_a,n_b --tp 2          # vLLM tensor parallel across 2 machines
opod shard create mimo-7b-ray --nodes n_a,n_b --pp 2          # vLLM pipeline parallel
opod shard create llama-3.3-70b-sharded --gang g1 --nodes n_c,n_d   # a second gang beside g0

Output:

▶ picked 2 part(s): the model needs 42.1 GB; the freest worker has 24.0 GB, so it does not fit in fewer parts; 2 parts of 21.1 GB fit on n_a (24.0 GB free), n_b (24.0 GB free)
▶ creating sharded model llama-3.3-70b-sharded on [n_a n_b] (this may take a few minutes)…
✔ sharded model ready: llama-3.3-70b-sharded

With --tp above 1 it also prints tensor-parallel across machines (tp=N): all-reduce twice per layer over the network — expect it to be latency-bound. A tensor group that crosses machines works, but every token pays for the network.

From core v0.4.6 the last line names what was built — ✔ llama-3.3-70b-sharded ready: gang g1 on n_a, n_b (head n_a) — see opod shard ls — read from the leader's own rows. A --nodes id the leader does not know is refused before anything starts; --node is the same flag as --nodes; a --nodes, --gang, --tp or --pp with no value, an unknown flag and a bad count are usage errors (exit 2). Ctrl-C (or SIGTERM) during the wait prints interrupted — the leader may hold a partial gang of …; clean it up with: opod shard remove … --gang … and exits 130; a failed create names the same cleanup. A line every 10 s on stderr says it is still creating.

Numbers must be numbers

--tp, --pp and N must be whole numbers. N that is not (or is below 1) is refused: opod: invalid shard count "x" (must be ≥1; 1 = whole model on one host). On 0.2.1 a --tp or --pp value that is not a number is read as 0 with no error, which means "not set". From 0.3.0 it is refused: opod: --tp "two" is not a whole number.

When the CLI picks the shape

With no N, no --nodes, no --tp and no --pp, the CLI picks the shape before it calls the leader:

  1. It reads the model's size from the catalog. A model with no recorded size keeps the catalog's default_shards and says so.
  2. It reads, from the leader's store, the workers that heartbeat within the bound, what they registered and what is placed on them, minus placement.reserve_percent.
  3. It picks the smallest number of equal parts that fits the free memory: 1 when the model fits one worker; never more parts than live workers or than the model's layers.
  4. It sends the picked workers as an explicit --nodes list, so the leader builds exactly what was printed.

When nothing fits, it refuses and prints the numbers, for example:

opod: cannot pick a shard count for llama-3.3-70b-sharded: the model needs 42.1 GB and no split fits: 2 live worker(s) have 30.0 GB free in total (n_a 18.0 GB, n_b 12.0 GB); even 2 part(s) need 21.1 GB each and worker n_b has 12.0 GB — free memory, join more workers, or name the count yourself

With no live worker: no live workers — join one (opod join) or name the count. Any shape you name is sent unchanged, and the admin API itself never picks: a request body with no count means the catalog's default_shards.

A leader with an in-memory store (managed mode) shows the picker no workers; give a count.

Placement without --nodes

The leader puts the parts on the strongest workers: a worker with a GPU before one without, then the biggest card, then the biggest host. Name --nodes to place them yourself.

Coordinator

The coordinator (llama.cpp's llama-server --rpc …) runs on the gang's worker with the most card memory. A worker with no card is chosen only when no candidate has one (then by host RAM), and the leader itself only when there are no workers. On the leader, OPOD_COORDINATOR_NODE=<node id> pins it; local forces the leader. It is ignored for one part.

Prerequisites (llama.cpp)

  • rpc-server on PATH on every part's worker, and llama-server on the coordinator's machine. opod doctor reports whether both are present.
  • The catalog entry has sharding.required: true, and either a readable source.path or a Hugging Face source.file, which the leader downloads and distributes to the parts (SHA-256 checked).
  • Parts listen from port 50052 up and the coordinator on 9001, unless the entry's sharding.rpc_port_base or sharding.coordinator_port says otherwise.

--tp with the llama.cpp backend is refused, because RPC splits by layer only:

tp=2: llama.cpp RPC sharding is layer-wise only and has no tensor split (tensor-parallel needs a backend that has one — set sharding.engine=vllm or sharding.engine=sglang in the catalog)

Timeouts

The CLI waits up to 45 minutes, because a cold create can download and distribute tens of gigabytes. Interrupting the CLI cancels the request, and with it the create on the leader. An interrupted create can leave part rows behind with no coordinator. Check with opod shard ls, and if the gang has no coordinator row, run opod shard remove MODEL --gang ID --yes and create it again.

Errors

A failed create prints the leader's status and body: opod: POST /admin/v1/shards/create: <status>: {"error":{…}}. Branch on error.code where it is set:

Statuserror.codeMeaning
404—no catalog entry for <model>.
409— or a reason nameThe workers cannot hold the shape, or the engine cannot run it. Nothing was changed. A named refusal carries its reason, for example sglang_pp_tied_llama (SGLang cannot run a pipeline of a Llama-family model with tied embeddings; use tensor parallelism or vLLM).
502gang_part_lostA part's worker went away while the gang formed. Its parts were stopped; create again.
502gang_part_failedA part's process failed to start. Its parts were stopped; read opod shard ls and the worker's logs.
502gang_create_in_flightAnother create of the same gang is running and decides the outcome. Wait, then read opod shard ls.
503—The leader has no orchestrator (a gateway or a door).

opod shard ls

opod shard ls
MODEL                            GANG   ROLE           NODE         ADDRESS                STATUS
llama-3.3-70b-sharded            g0     coordinator    n_a          192.0.2.51:9001        ready
llama-3.3-70b-sharded            g0     rpc            n_a          192.0.2.51:50052       ready
llama-3.3-70b-sharded            g0     rpc            n_b          192.0.2.52:50052       ready
mimo-7b-ray                      g0     rank           n_c          192.0.2.53:6379        ready
mimo-7b-ray                      g0     rank           n_d          192.0.2.54             ready
mimo-7b-ray                      g0     coordinator    n_c          192.0.2.53:9100        ready
ColumnMeaning
GANGThe gang id. A row with none shows g0, the default gang.
ROLEcoordinator (the process the router sends requests to), rpc (a llama.cpp RPC part), or rank (one node of a vLLM or SGLang gang; for vLLM on Ray, rank 0 is the Ray head and the coordinator row points at its vLLM server on port 9100).
NODEThe worker that runs the process.
ADDRESSWhere the coordinator is dialled, or where a part listens.
STATUSstarting, ready, failed or stopped. A vLLM or SGLang coordinator reads starting until its API answers (from core v0.4.2; see When a vLLM or SGLang gang is ready).

With no gangs, it prints (no shards — create one with `opod shard create <model>`). For machine output, call GET /admin/v1/shards; GET /admin/v1/shards/processes lists the supervised processes behind the rows. From core v0.4.6, opod shard ls --json prints the leader's list as it is, a field the leader leaves out reads -, and an answer that is not a shard list is an error instead of (no shards …). opod shard remove of a model (or gang) with no rows says no gang of … to remove — nothing changed and exits 0.

opod shard remove

opod shard remove llama-3.3-70b-sharded             # every gang; prompts
opod shard remove llama-3.3-70b-sharded --yes       # no prompt; -y is the same
opod shard remove llama-3.3-70b-sharded --gang g1   # one gang; the others keep serving

The prompt reads Tear down sharded model "…"? The coordinator + every rpc-server will be stopped. (y/N), or, with --gang, Tear down gang "g1" of "…"? Its coordinator + rpc-servers stop; the model's other gangs keep serving. (y/N). Only y or yes goes on. With no terminal on stdin, the answer is no and the command exits opod: aborted; scripts pass --yes.

It stops the coordinator and every part, and deletes the rows:

▶ removing llama-3.3-70b-sharded gang g1…
✔ removed llama-3.3-70b-sharded gang g1

The model keeps its placement while any gang is left.

Managed endpoints heal their gangs

On a leader that runs with a mounted plan file, a gang the plan declares is formed again by the leader once every part of it is gone and free workers have registered. To remove such a gang for good, change the plan, not the leader.

Last updated · Source: content/docs/core-cli/shard.mdx · View as Markdown