agentleFS
Seeed-ProjectsSeeed-Projects/Seeed-Jetson-DevelopTool/skills/claude/llama-cpp-rpc-distributed/CLAUDE.md

Seeed-Jetson-DevelopTool / llama-cpp-rpc-distributed

CLAUDE.md57 starsChanged 4 months agoMITView on GitHub

Distribute LLM inference across multiple Jetson devices using llama.cpp RPC backend with CUDA. Build from source with RPC+CUDA, convert models to GGUF, and run multi-node inference for horizontal scaling. Requires two Jetson devices with JetPack 6.x+.

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run large language models across multiple Jetson devices by leveraging llama.cpp's RPC backend.

    line 8
  2. Distinctive:

    Run one phase at a time. After each phase:

    line 14
  3. Very specific:

    If output contains [STOP] → stop, consult the failure decision tree.

    line 16
  4. Very specific:

    If output ends with [OK] → tell the user "Phase N complete" and proceed.

    line 17
  5. Distinctive:

    Run on both machines:

    line 35
  6. Distinctive:

    Run on the client machine (Machine A):

    line 74
  7. Very specific:

    Default port is 50052. Customize with -p <port>.

    line 132

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Distributed llama.cpp on Jetson (RPC Mode)

Run large language models across multiple Jetson devices by leveraging llama.cpp's RPC backend. This enables horizontal scaling — split model layers across GPUs on different machines connected via LAN.


Execution model

Run one phase at a time. After each phase:

  • Relay all output to the user.
  • If output contains [STOP] → stop, consult the failure decision tree.
  • If output ends with [OK] → tell the user "Phase N complete" and proceed.

Prerequisites

RequirementDetail
HardwareTwo reComputer Jetson devices (e.g. Orin NX/AGX Orin)
JetPack6.x+ with working CUDA drivers
NetworkBoth devices on same LAN, able to ping each other
RAMClient ≥ 64 GB, remote node ≥ 32 GB (unified memory)
Storage~5 GB free for build + model

Phase 1 — Clone and install build dependencies (~2 min)

Run on both machines:

git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
sudo apt update
sudo apt install -y build-essential cmake git libcurl4-openssl-dev python3-pip

[OK] when clone and apt install complete on both machines.


Phase 2 — Build with RPC + CUDA backend (~5 min)

Run on both machines:

cd llama.cpp
cmake -B build \
  -DGGML_CUDA=ON \
  -DGGML_RPC=ON \
  -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

Verify:

ls build/bin/llama-cli build/bin/rpc-server

[OK] when both llama-cli and rpc-server binaries exist. [STOP] if cmake or build fails — see failure decision tree.


Phase 3 — Install Python conversion tools (~1 min)

Run on the client machine (Machine A):

cd llama.cpp
pip3 install -e .

[OK] when pip install completes.


Phase 4 — Download and convert model (~5–10 min)

Using TinyLlama-1.1B-Chat as an example:

pip3 install huggingface-hub
huggingface-cli download TinyLlama/TinyLlama-1.1B-Chat-v1.0 --local-dir ~/TinyLlama-1.1B-Chat-v1.0

Convert to GGUF:

cd llama.cpp
python3 convert_hf_to_gguf.py \
  --outfile ~/TinyLlama-1.1B.gguf \
  ~/TinyLlama-1.1B-Chat-v1.0

[OK] when GGUF file is created. [STOP] if conversion fails — check model files are complete.


Phase 5 — Verify single-machine inference (~1 min)

cd llama.cpp
./build/bin/llama-cli \
  -m ~/TinyLlama-1.1B.gguf \
  -p "Hello, how are you today?" \
  -n 64

[OK] when the model generates a text response. [STOP] if inference fails — check CUDA with nvidia-smi.


Phase 6 — Start RPC server on remote machine (Machine B)

SSH into Machine B and run:

cd llama.cpp
CUDA_VISIBLE_DEVICES=0 ./build/bin/rpc-server --host <MACHINE_B_IP>

Default port is 50052. Customize with -p <port>.

[OK] when server prints "listening on <IP>:50052".


Phase 7 — Start RPC server on local machine (Machine A)

In a separate terminal on Machine A:

cd llama.cpp
CUDA_VISIBLE_DEVICES=0 ./build/bin/rpc-server -p 50052

[OK] when server prints listening message.


Phase 8 — Run distributed inference (~1 min)

On Machine A, in another terminal:

cd llama.cpp
./build/bin/llama-cli \
  -m ~/TinyLlama-1.1B.gguf \
  -p "Hello, my name is" \
  -n 64 \
  --rpc <MACHINE_B_IP>:50052,127.0.0.1:50052 \
  -ngl 99

-ngl 99 offloads all layers to GPU across both RPC nodes.

[OK] when distributed inference produces output and both RPC servers show activity. [STOP] if connection refused — check network and firewall.


Failure decision tree

SymptomAction
cmake fails with CUDA not foundVerify CUDA: nvcc --version. Ensure JetPack 6.x is installed.
Build fails with missing headersRun sudo apt install -y build-essential cmake libcurl4-openssl-dev.
rpc-server startup failureCheck if port 50052 is occupied: ss -tlnp | grep 50052. Check firewall: sudo ufw allow 50052.
Connection refused during distributed inferenceVerify machines can ping each other. Confirm RPC servers are running on both.
Slower inference with RPC than single-nodeModel too small for network overhead to pay off. Try a larger model (7B+).
Out of memory errorReduce -ngl value to keep some layers on CPU. Close other GPU processes.
Model conversion failsEnsure all model files downloaded completely. Check disk space.

Reference files

  • references/source.body.md — Full Seeed Wiki tutorial with hardware topology diagrams, performance comparison screenshots, and troubleshooting details (reference only)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.