Hardware · Clusters · Tools

prima.cpp

by Zonghang Li et al. (OpenCPIL) · MIT · 129 GitHub stars · Experimental · no releases

A research version of llama.cpp for low-memory home devices on Wi-Fi: it chains laptops, desktops and even phones in a ring, reads layers from disk as needed, and drops devices that would slow things down.

Go to prima.cpp Source code

At a glance

Best for
Getting a 30B-70B model running at all on a few ordinary laptops, desktops and Android phones whose memory together is still too small.
Runs on
macOS (Metal), Linux (CUDA or processor) and Android through Termux can mix in one cluster. No Windows, no Vulkan or ROCm yet; Raspberry Pi-type boards are untested.
How it splits a model
Pipeline in a ring, with its Halda solver deciding how many layers each device takes (and leaving out devices that would slow the rest).
Connections
Made for home Wi-Fi: it barely needs bandwidth, but latency matters.
How devices join
Manual: each device is started with its place in the ring.
Models
GGUF (tested with Llama, Qwen 2.5, QwQ and DeepSeek R1 distills).
API
OpenAI compatible (llama-server on the first device).
Rules
Every device needs its own copy of the model file on a fast disk.

Get started

macOS

brew install gcc make cmake fio git wget highs zeromq curl, then make -j

Linux

Build with make -j (GGML_CUDA=1 for NVIDIA, USE_HIGHS=1 on the first device)

Then:

./llama-server -m model.gguf --world 2 --rank 0 --master 192.168.1.2 --next 192.168.1.3 --prefetch   # device 1
./llama-cli -m model.gguf --world 2 --rank 1 --master 192.168.1.2 --next 192.168.1.2 --prefetch   # device 2

Published speeds

Measured by the project or its users, for one person chatting. Our own estimates for any set of devices are in the cluster builder.

Limits to know

Open issues worth reading:

Sources:

All clustering tools

Estimates come from published hardware specs and our open formulas, not from running the model on your machine. Real speed varies with runtime, drivers and settings. Numbers marked “Measured” come from a linked benchmark.

Was this page helpful?