fix: use gpus:all for GPU passthrough, detect Docker Desktop in start.sh
This commit is contained in:
1 parent
7f5fc7fea3
commit
4b33af54ae
3 files changed
+11
-15
No files matched your search
@@ -1,4 +1,3 @@
|
||||
services:
|
||||
backend:
|
||||
devices:
|
||||
- nvidia.com/gpu=all
|
||||
gpus: all
|
||||
+5
-3
@@ -405,8 +405,10 @@ would wipe the class and leave only the drawings.
|
||||
- `docker-compose.yml` — a `backend` service (GPU passthrough, `./data` volume, video archive
|
||||
mounted read-write (REQ-178), `.env` for `HF_TOKEN`) and a `frontend` service (nginx: static
|
||||
files + `/api` proxy, `client_max_body_size 20g`).
|
||||
- GPU access uses **CDI** (`devices: nvidia.com/gpu=all`), not the legacy `runtime: nvidia`.
|
||||
Docker Engine 27+ discovers `nvidia.com/gpu` through the container toolkit; the runtime
|
||||
entry in `/etc/docker/daemon.json` is not registered with the daemon here.
|
||||
- GPU access uses compose **`gpus: all`** (same path as the `docker run --gpus all` CLI flag).
|
||||
The earlier CDI form (`devices: nvidia.com/gpu=all`) fails on Docker Desktop's WSL2 backend
|
||||
with `unresolvable CDI devices` because no CDI spec exists there; `gpus: all` works on both
|
||||
Docker Desktop and a native engine with the NVIDIA container toolkit.
|
||||
The runtime entry in `/etc/docker/daemon.json` is not registered with the daemon here.
|
||||
- The frontend pins **Vite 7**. Vite 8's default bundler (Rolldown) ships a native binding
|
||||
that dies with a bus error on this machine; Vite 7's Rollup path works.
|
||||
@@ -10,8 +10,11 @@ rm -f docker-compose.override.yml
|
||||
if command -v nvidia-smi &> /dev/null; then
|
||||
echo "✅ NVIDIA GPU detected."
|
||||
|
||||
# 2. Check if the NVIDIA Container Toolkit is installed
|
||||
# 2. Docker Desktop ships its own GPU support; a native engine needs the NVIDIA Container Toolkit
|
||||
if ! command -v nvidia-ctk &> /dev/null; then
|
||||
if docker info --format '{{.Name}}' 2>/dev/null | grep -q docker-desktop; then
|
||||
echo "🐳 Docker Desktop detected — GPU support is built in, no toolkit needed."
|
||||
else
|
||||
echo "⚠️ NVIDIA Container Toolkit is missing."
|
||||
echo " Without it, Docker cannot access your GPU, and the app will run in CPU-only mode."
|
||||
read -p "Would you like to install it automatically now? (requires sudo) [y/N] " install_choice
|
||||
@@ -30,22 +33,14 @@ if command -v nvidia-smi &> /dev/null; then
|
||||
echo "⚠️ Skipping installation. Proceeding without GPU support."
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. If Toolkit is available, configure CDI and enable GPU passthrough
|
||||
if command -v nvidia-ctk &> /dev/null; then
|
||||
if [ ! -f "/etc/cdi/nvidia.yaml" ]; then
|
||||
echo "⚙️ Generating Docker CDI configuration..."
|
||||
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
|
||||
fi
|
||||
|
||||
echo "🔌 Enabling GPU support via docker-compose.override.yml..."
|
||||
cat <<EOF > docker-compose.override.yml
|
||||
services:
|
||||
backend:
|
||||
devices:
|
||||
- nvidia.com/gpu=all
|
||||
gpus: all
|
||||
EOF
|
||||
fi
|
||||
else
|
||||
echo "ℹ️ No NVIDIA GPU detected. Running in CPU-only mode."
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user