macOS Thunderbolt 5 RDMA & MLX JACCL Multi-Mac Cluster Verifier + Launcher (launch-mac-tb5-rdma-mlx-cluster.sh)
Audits rdma_ctl status and ibv_devices (rdma_en*) across Thunderbolt 5 peers, sets iogpu.wired_limit_mb, generates a full-mesh JACCL hostfile via mlx.distributed_config, and launches tensor-parallel MLX inference with MLX_METAL_FAST_SYNCH=1.
macOS Thunderbolt 5 RDMA & MLX JACCL Multi-Mac Cluster Verifier + Launcher
Audits rdma_ctl status and ibv_devices (rdma_en*) across Thunderbolt 5 peers, sets iogpu.wired_limit_mb, generates a full-mesh JACCL hostfile via mlx.distributed_config, and launches tensor-parallel MLX inference with MLX_METAL_FAST_SYNCH=1.
#!/usr/bin/env bash
# Tinker AI — macOS Thunderbolt 5 RDMA & MLX JACCL Distributed Cluster Launcher (Guide #41)
set -euo pipefail
HOSTS="mac-studio-1.local,mac-studio-2.local"
MODEL="mlx-community/DeepSeek-R1-671B-4bit"
WIRED_MB="110592"
HOSTFILE="tb5-jaccl-hosts.json"
echo "=== [1/4] Auditing Thunderbolt 5 RDMA Subsystem (rdma_ctl & ibv_devices) ==="
rdma_ctl status || echo "[WARN] rdma_ctl not enabled! Reboot into macOS Recovery -> Terminal -> run: rdma_ctl enable"
ibv_devices | grep -E "rdma_en|device" || {
echo "[ERROR] No rdma_en* verbs device found. Ensure Thunderbolt 5 cables are directly connected (no daisy chain)."
exit 1
}
echo "=== [2/4] Raising Metal Wired Memory Limit ($WIRED_MB MB) Across Cluster Nodes ==="
IFS=',' read -ra NODE_ARRAY <<< "$HOSTS"
for NODE in "${NODE_ARRAY[@]}"; do
echo "-> Tuning $NODE"
ssh "$NODE" "sudo sysctl -w iogpu.wired_limit_mb=$WIRED_MB && ibv_devices"
done
echo "=== [3/4] Generating JACCL Full-Mesh Topology Config ($HOSTFILE) ==="
mlx.distributed_config --verbose --hosts "$HOSTS" --backend jaccl > "$HOSTFILE"
cat "$HOSTFILE"
echo "=== [4/4] Launching Tensor-Parallel MLX Distributed Inference (JACCL + Fast Metal Sync) ==="
mlx.launch \
--backend jaccl \
--hostfile "$HOSTFILE" \
--env MLX_METAL_FAST_SYNCH=1 \
-m mlx_lm.generate \
--model "$MODEL" \
--max-tokens 512 \
--prompt "Explain why Thunderbolt 5 RDMA (~3 us latency) enables Tensor Parallelism across Apple Silicon Macs."
Customizable Parameter Reference for launch-mac-tb5-rdma-mlx-cluster.sh
This SH artifact exposes 3 template variables compiled client-side in your browser.
| Template Token | Parameter Description | Verified Default | Example Format |
|---|---|---|---|
{{CLUSTER_HOSTS}} | Comma-separated Mac hostnames/IPs | mac-studio-1.local,mac-studio-2.local | mac-studio-1.local,mac-studio-2.local |
{{MLX_MODEL_REPO}} | MLX Model Repo / Local Path | mlx-community/DeepSeek-R1-671B-4bit | mlx-community/DeepSeek-R1-671B-4bit |
{{WIRED_LIMIT_MB}} | Per-Node Metal Wired Limit (MB) | 110592 | 110592 |
Verified Environment for "Multi-Mac Thunderbolt 5 RDMA Cluster for Local LLMs: rdma_ctl, MLX JACCL (--backend jaccl) vs exo vs llama.cpp RPC & Mac Studio M5 Ultra (512GB · 1.2 TB/s) Sizing"
Measured on: 2× MacBook Pro M5 Max (128GB · 614 GB/s each = 256GB pool) & 2× Mac Studio M3 Ultra (256GB · 819 GB/s each = 512GB pool) via Belkin 1m active Thunderbolt 5 (80 Gbps) cables | Spec-estimate row: Mac Studio M5 Ultra (512GB · ~1,200 GB/s)
All collective operations (`all_sum`, `all_gather`) run over direct point-to-point Thunderbolt 5 RDMA verbs (`rdma_en*`) without touching Wi-Fi, WAN routers, or external cloud APIs.
- Enabling Thunderbolt RDMA (`rdma_ctl enable`) **must be executed inside macOS Recovery Mode Terminal** on every participating Mac, and requires **Thunderbolt 5 hardware** (M4 Pro / M4 Max / M3 Ultra / M5 Pro / M5 Max / M5 Ultra) on macOS 26.2+. Older Thunderbolt 3/4 Macs only support TCP/IP over Thunderbolt Bridge (`--backend ring`).
- **No daisy-chaining allowed for JACCL:** `mlx.launch --backend jaccl` requires a **direct point-to-point full mesh** (`N × (N - 1) / 2` Thunderbolt 5 cables: 1 cable for 2 Macs, 3 cables for 3 Macs, **6 cables for 4 Macs**). Daisy-chaining Macs in a line causes `ibv_create_qp` / RDMA verb failures.
- The **Mac Studio M5 Ultra (512GB · ~1,200 GB/s)** row in Table 1 is a **SPEC-DERIVED ESTIMATE (`[Spec-Est.]`)** based on 2× M5 Max UltraFusion scaling and is not yet lab-measured on retail hardware.
3-Step Verification Checklist After Deploying launch-mac-tb5-rdma-mlx-cluster.sh
- Ran `rdma_ctl enable` inside macOS Recovery Mode Terminal on every participating Mac and confirmed `ibv_devices` lists `rdma_en*` interfaces after reboot.
- Connected active Thunderbolt 5 (80 Gbps) cables in a direct point-to-point full mesh (1 cable for 2 Macs, 3 for 3 Macs, 6 for 4 Macs; zero daisy-chaining).
- Raised `sudo sysctl -w iogpu.wired_limit_mb=...` on all nodes and passed `--env MLX_METAL_FAST_SYNCH=1` to `mlx.launch --backend jaccl`.