Cluster tax, part 2: what both Sparks need
What must be on both DGX Sparks? Both need the same container image, stored on each. The model files can have one copy, on the first Spark.
Chapters
- 0:00Introduction
- 0:04Two things: Image and weights
- 0:12The image: Check the image
- 0:20Copy it: Save, send, load
- 0:32The cache: Share the whole hub
- 0:43First Spark: Export it read-only
- 0:58Permissions: Who may read
- 1:10Second Spark: Mount and test
- 1:18After a reboot: Come back, don't hang
- 1:27Containers: Same path, offline
- 1:38The trade: What it costs
- 1:46To undo: Second Spark first
- 1:55Wrap up
Read the transcript
Introduction
What must be on both DGX Sparks?
Two things: Image and weights
Both need the same container image, stored on each. The model files can have one copy, on the first Spark.
The image: Check the image
Compare image IDs. A matching name isn't enough. If they differ, check each image store, and compare layers.
docker image inspect \
--format '{{.Id}}' IMAGE:TAG
docker info -f '{{ .DriverStatus }}'Copy it: Save, send, load
To copy it, send docker save through SSH into docker load. Loading can move a tag on the second Spark, so check its images first. Or pull the same digest on both.
docker image save IMAGE:TAG |
ssh USER@SECOND-SPARK-LINK-ADDRESS \
docker image load
docker pull IMAGE@sha256:DIGESTThe cache: Share the whole hub
Share the whole Hugging Face hub folder, because its snapshots are links within it. Don't share the folder above, which by default holds your access token.
First Spark: Export it read-only
Installing the NFS server starts a network service, and you'll edit a system file. In the exports file, share the hub folder only with the second Spark's link address, read-only, root squashed, no space before the bracket.
sudo apt install nfs-kernel-server
sudo exportfs -raPermissions: Who may read
NFS goes by user numbers, and a root user on the second Spark is treated as nobody. So the files must be readable to others, or the export must map requests to your own user.
Second Spark: Mount and test
On the second Spark, mount it into an empty folder. Check that links open, and that writing to the share fails.
sudo mount -t nfs -o ro \
FIRST-SPARK-LINK-ADDRESS:/home/USER/\
.cache/huggingface/hub /mnt/sparkhub
touch /mnt/sparkhub/should-failAfter a reboot: Come back, don't hang
Back up the boot file before you edit it. The no fail option lets boot carry on, and automount connects when the folder is first used.
Containers: Same path, offline
Give both containers the model folder at the same path inside. Offline mode stops the second one trying to download. So download on the first.
The trade: What it costs
The second Spark now depends on the first, and on the link. Loading goes over the network, so time it yourself.
To undo: Second Spark first
To undo, stop the containers, unmount the second Spark, and remove its boot line. Only then remove the export on the first.
Wrap up
We haven't run these on hardware, so check each.
Sources
- docs.docker.com/reference/cli/docker/image/save
- docs.docker.com/reference/cli/docker/image/load
- docs.docker.com/reference/cli/docker/image/pull
- docs.docker.com/engine/storage/containerd
- ubuntu.com/server/docs/how-to/networking/install-nfs
- manpages.ubuntu.com/manpages/noble/man5/exports.5.html
- manpages.ubuntu.com/manpages/noble/man5/nfs.5.html
- manpages.ubuntu.com/manpages/noble/man5/systemd.mount.5.html
- huggingface.co/docs/huggingface_hub/guides/manage-cache
- huggingface.co/docs/huggingface_hub/package_reference/environment_variables
- docs.vllm.ai/en/latest/serving/parallelism_scaling