TinkerLab
ARTIFACT // LAUNCH-MAC-TB5-RDMA-MLX-CLUSTER.SH (SH)

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.

[KEY VERIFIED TAKEAWAY / TL;DR]This reproducible configuration artifact "macOS Thunderbolt 5 RDMA & MLX JACCL Multi-Mac Cluster Verifier + Launcher" (launch-mac-tb5-rdma-mlx-cluster.sh, SH) is paired with Tinker AI Lab's hardware-verified guide "thunderbolt-5-rdma-mlx-jaccl-exo-llama-cpp-rpc-multi-mac-studio-cluster-benchmark". It exposes 3 customizable browser variables (CLUSTER_HOSTS=mac-studio-1.local,mac-studio-2.local, MLX_MODEL_REPO=mlx-community/DeepSeek-R1-671B-4bit, WIRED_LIMIT_MB=110592) with loopback-first security defaults.
01 // HOMELABLocal AI / HomeLab· Verified: 2026-11-09
Browse All 42 Artifacts →
launch-mac-tb5-rdma-mlx-cluster.sh

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.

View Paired Guide →
Customizable Variables (Saved in Browser)
UTF-8 Encoded · Live Client-Side Compilation
#!/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."
PARAMETER SPECIFICATION // 参数化变量规范说明表

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 TokenParameter DescriptionVerified DefaultExample Format
{{CLUSTER_HOSTS}}Comma-separated Mac hostnames/IPsmac-studio-1.local,mac-studio-2.localmac-studio-1.local,mac-studio-2.local
{{MLX_MODEL_REPO}}MLX Model Repo / Local Pathmlx-community/DeepSeek-R1-671B-4bitmlx-community/DeepSeek-R1-671B-4bit
{{WIRED_LIMIT_MB}}Per-Node Metal Wired Limit (MB)110592110592
PAIRED HARDWARE MANIFEST // 配套实测环境与边界记录

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"

Tested Hardware & OS

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)

Pinned Stack & Model Versions
MLX 0.25+ & mlx-lm 0.24+ (`mlx.distributed` with `--backend jaccl` & `MLX_METAL_FAST_SYNCH=1`)exo 0.4+ (Thunderbolt RDMA / Ring discovery mode) & llama.cpp b4920+ (`rpc-server` / `ggml-rpc`)Models: Qwen3-235B-A22B-4bit (MLX ~132 GB) & DeepSeek-R1-671B-4bit (MLX ~378 GB)
Offline Boundary (100% Air-Gapped Direct Thunderbolt 5 RDMA Mesh)

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.

Known Operational Limits & Failure Modes
  • 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.
DEPLOYMENT CHECKLIST // 配置落地核验步骤

3-Step Verification Checklist After Deploying launch-mac-tb5-rdma-mlx-cluster.sh

  1. Ran `rdma_ctl enable` inside macOS Recovery Mode Terminal on every participating Mac and confirmed `ibv_devices` lists `rdma_en*` interfaces after reboot.
  2. 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).
  3. Raised `sudo sysctl -w iogpu.wired_limit_mb=...` on all nodes and passed `--env MLX_METAL_FAST_SYNCH=1` to `mlx.launch --backend jaccl`.