GLM-5.3-Flash EXL3 on 2x DGX Spark with TensorFold
Python
Use both PCIe links of a cabled QSFP port (DGX Spark twins)
webzoned5afeb041b40
diff --git a/README.md b/README.mdindex dcaf512..53f07b3 100644--- a/README.md+++ b/README.md@@ -77,8 +77,11 @@ of 11 sent in a burst).- **Two DGX Sparks** (or two GB10 systems with 128 GB unified memory), with nothing else large on their GPUs: eachneeds ~110 GiB free memory when the server starts (`start.sh` warns below that; stop other GPU work).- **A direct ConnectX-7 link:** a QSFP cable between the CX7 ports and an IPv4 address on each end in one private- subnet (e.g. `192.0.2.1/24` and `192.0.2.2/24`; `ping` must work), with a RoCE v2 GID (`start.sh` checks). With- both ports cabled and addressed, both are used (a prompt chunk's all-gather is ~1.8x faster on two rails).+ subnet (e.g. `192.0.2.1/24` and `192.0.2.2/24`; `ping` must work), with a RoCE v2 GID (`start.sh` checks). One QSFP+ port of a Spark reaches the GB10 over two PCIe Gen5 x4 links, so it appears as two netdevs and two RoCE devices+ (`enp1s0f0np0` / `enP2p1s0f0np0`, `rocep1s0f0` / `roceP2p1s0f0`), and the two twins need **different** subnets - that+ is what NVIDIA's own two-Spark playbook does. Both twins of the cabled port are then used, as is a second cabled+ port: a prompt chunk's all-gather is ~1.8x faster on two rails, and one rail is one x4 (~112 Gb/s of the port's 200).- **Key-based ssh** from the first Spark (the head, which runs `./start.sh` and the API) to the second (the worker):`ssh-copy-id user@<worker>` (after `ssh-keygen -t ed25519` if you have no key); check with`ssh -o BatchMode=yes user@<worker> true`.@@ -318,8 +321,8 @@ changes nothing until the pin does. Set one empty to take the Hub's `main` whenLess common settings are described in `scripts/config.sh` and `scripts/nodes.sh`: `MODEL_ID`, `DFLASH2_ID`,`TF_VERSION`, `TF_REPO`, `BASE_IMAGE` (the patches are made for TensorFold v0.6.0; after changing any of these run`scripts/prepare.sh --rebuild`), `IMAGE`, `CONTAINER_NAME`, `GHCR_IMAGE`, `HF_CACHE` (default `$HF_HOME` or-`~/.cache/huggingface`), `KERNEL_CACHE`, `STATE_DIR`, `MIN_FREE_GB`, `IMAGE_FREE_GB`, `NCCL_RAILS` (`1`: one CX7-port even when both are up), `NCCL_CHANNELS` (4), `NCCL_DEBUG`, `RSYNC_OPTS`. `start.sh` also takes `HF_HUB_OFFLINE=0` (let the+`~/.cache/huggingface`), `KERNEL_CACHE`, `STATE_DIR`, `MIN_FREE_GB`, `IMAGE_FREE_GB`, `NCCL_RAILS` (`1`: one RoCE+port even when the cabled port's two PCIe links, or a second port, are up), `NCCL_CHANNELS` (4), `NCCL_DEBUG`, `RSYNC_OPTS`. `start.sh` also takes `HF_HUB_OFFLINE=0` (let theserver reach Hugging Face; by default it serves from the local cache only).### Thinking and samplingdiff --git a/scripts/nodes.sh b/scripts/nodes.shindex 24265fa..1931964 100644--- a/scripts/nodes.sh+++ b/scripts/nodes.sh@@ -61,8 +61,10 @@ link_info() {echo "$src $dev ${hca:--} ${idx:--}"}-# rails <netdev> <gid index>: every RoCE device of this node on the link's subnet (the CX7's second port too, when it-# is up and addressed there) whose RoCE v2 IPv4 GID sits at the same index, the link's own device first.+# rails <netdev> <gid index>: the RoCE devices this node can run the link on - the link's own device first, then every+# other RoCE device whose RoCE v2 IPv4 GID sits at the same index: one on the link's subnet (a second CX7 port, when it+# is up and addressed there), and the second PCIe link of the same QSFP port (a DGX Spark's "twin", which lives in its+# own subnet, so the subnet scan below cannot see it).rails() {local dev=$1 gid=$2 net cidr hcas other ip idxcidr=$(ip -o -4 addr show dev "$dev" | awk '{print $4}' | head -1)@@ -78,6 +80,21 @@ rails() {[[ "$(cat /sys/class/infiniband/$idx/ports/1/gid_attrs/types/$gid 2>/dev/null)" == *v2* ]] || continuehcas+=",$idx"done+ # A DGX Spark's QSFP port reaches the GB10 over two independent PCIe Gen5 x4 links, so one cabled port shows up as+ # two netdevs and two RoCE devices (rocep1s0f0 and roceP2p1s0f0), and NVIDIA's own two-Spark playbook gives the two+ # twins different subnets - so the scan above never sees the twin and NCCL gets one x4: ~112 Gb/s of the port's 200.+ # Pair the twin by name instead of by subnet: same fN/npM tail, different PCIe prefix. Same conditions as above+ # (link up, a RoCE v2 GID at $gid), and never add a device twice.+ local tail=${dev##*f} other2 ib2+ for n in /sys/class/net/*; do+ other2=${n##*/}+ [[ "$other2" == "$dev" || "$other2" != *f"$tail" ]] && continue+ [[ -d $n/device/infiniband && "$(cat $n/operstate 2>/dev/null)" == up ]] || continue+ ib2=$(ls $n/device/infiniband | head -1)+ [[ -n "$ib2" && ","$hcas"," != *","$ib2,","* ]] || continue+ [[ "$(cat /sys/class/infiniband/$ib2/ports/1/gid_attrs/types/$gid 2>/dev/null)" == *v2* ]] || continue+ hcas+=",$ib2"+ doneecho "$hcas"}