Add proper support for DGX spark with easy manager. Thank you NVIDIA!
This commit is contained in:
1 parent
cbc6bbdd70
commit
60ca869b38
9 files changed
+61
-120
No files matched your search
+3
-3
@@ -21,11 +21,11 @@ python3 -m manager doctor # diagnose problems
|
||||
- **Hardware → spec mapping** is in [spec.py](spec.py). One universal torch
|
||||
pin (2.13.0 / torchvision 0.28.0 / torchaudio 2.11.0) on every platform:
|
||||
cu130 wheels when the driver supports CUDA 13 (cu126 fallback for older
|
||||
drivers, refused outright on Blackwell GPUs which need cu130), same stack +
|
||||
Python 3.11 + `dgx_requirements.txt` on DGX/Grace, PyPI wheels on Mac,
|
||||
drivers, refused outright on Blackwell GPUs which need cu130), the same
|
||||
stack on Linux aarch64 (DGX Spark / Grace), PyPI wheels on Mac,
|
||||
rocm7.1 (experimental) for AMD, `--cpu` to force a CPU install. **Torch
|
||||
pins there must be updated together with the README install instructions,
|
||||
run_mac.zsh, and dgx_instructions.md.**
|
||||
and run_mac.zsh.**
|
||||
- **Accelerators everywhere wheels exist**, via per-spec `extra_packages`
|
||||
(installed after requirements with `--upgrade` so they override pins) and
|
||||
`optional_packages` (installed one-by-one, warn-only on failure):
|
||||
|
||||
@@ -108,7 +108,4 @@ def detect():
|
||||
|
||||
if IS_MAC:
|
||||
result["backend"] = "mps" if arch == "arm64" else "cpu"
|
||||
|
||||
# DGX OS / Grace (GB10, DGX Spark): NVIDIA GPU on aarch64 Linux
|
||||
result["is_dgx"] = bool(result["os"] == "linux" and arch == "aarch64" and nvidia)
|
||||
return result
|
||||
+54
-2
@@ -81,6 +81,34 @@ def _venv_platform():
|
||||
return None
|
||||
|
||||
|
||||
def _venv_has_headers():
|
||||
"""True if the venv's base interpreter ships Python.h.
|
||||
|
||||
triton JIT-compiles a small C launcher (cuda_utils.c) on first GPU use and
|
||||
needs the headers; a venv built on a distro Python without the -dev
|
||||
package fails there with "Python.h: No such file or directory".
|
||||
"""
|
||||
if not venv_exists():
|
||||
return False
|
||||
try:
|
||||
out = subprocess.run(
|
||||
[
|
||||
venv_python(),
|
||||
"-c",
|
||||
"import os, sysconfig; print(os.path.isfile(os.path.join("
|
||||
"sysconfig.get_paths()['include'], 'Python.h')))",
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL,
|
||||
timeout=30,
|
||||
env=clean_env(),
|
||||
)
|
||||
# unknown -> assume fine rather than recreate on a flaky probe
|
||||
return out.returncode != 0 or out.stdout.decode().strip() == "True"
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return True
|
||||
|
||||
|
||||
def _uv_python_platform(uv_python):
|
||||
"""'win-arm64' / 'win-amd64' expected for a pinned uv interpreter request."""
|
||||
if not uv_python:
|
||||
@@ -113,6 +141,21 @@ def ensure_venv(spec, dry_run=False):
|
||||
)
|
||||
import shutil
|
||||
|
||||
shutil.rmtree(venv_dir(), ignore_errors=True)
|
||||
elif find_uv() and not _venv_has_headers():
|
||||
if dry_run:
|
||||
info(
|
||||
"[dry-run] venv Python has no C headers — would recreate "
|
||||
"it on a uv-managed Python."
|
||||
)
|
||||
return venv_python()
|
||||
warn(
|
||||
"Existing venv is built on a Python without C headers "
|
||||
"(Python.h), which triton needs — recreating it on a "
|
||||
"uv-managed Python (all packages will be reinstalled)."
|
||||
)
|
||||
import shutil
|
||||
|
||||
shutil.rmtree(venv_dir(), ignore_errors=True)
|
||||
else:
|
||||
return venv_python()
|
||||
@@ -134,7 +177,17 @@ def ensure_venv(spec, dry_run=False):
|
||||
if uv:
|
||||
info("Creating venv with uv (python %s) at %s" % (python_request, target))
|
||||
run(
|
||||
[uv, "venv", target, "--python", python_request, "--seed"],
|
||||
# --managed-python: never build on a distro Python, which may
|
||||
# lack the C headers triton needs (see _venv_has_headers)
|
||||
[
|
||||
uv,
|
||||
"venv",
|
||||
target,
|
||||
"--python",
|
||||
python_request,
|
||||
"--managed-python",
|
||||
"--seed",
|
||||
],
|
||||
env=clean_env(),
|
||||
)
|
||||
else:
|
||||
@@ -382,7 +435,6 @@ def requirements_hash(spec):
|
||||
for f in os.listdir(REPO_ROOT)
|
||||
if f.startswith("requirements") and f.endswith(".txt")
|
||||
]
|
||||
req_files.append(os.path.join(REPO_ROOT, "dgx_requirements.txt"))
|
||||
base = file_hash(req_files)
|
||||
import hashlib
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ from .util import (
|
||||
)
|
||||
|
||||
NODE_DIR = os.path.join(REPO_ROOT, ".node")
|
||||
# Node 24 is the current LTS line and matches the dgx_instructions.md guidance.
|
||||
# Node 24 is the current LTS line.
|
||||
NODE_VERSION = "24.11.1"
|
||||
MIN_NODE_MAJOR = 20
|
||||
|
||||
|
||||
@@ -306,16 +306,6 @@ def _cuda_spec(detection):
|
||||
arch = detection["arch"]
|
||||
flavor, notes = _cuda_flavor(detection)
|
||||
python_version = "3.12"
|
||||
requirements = (
|
||||
"dgx_requirements.txt" if detection.get("is_dgx") else "requirements.txt"
|
||||
)
|
||||
if detection.get("is_dgx"):
|
||||
# the old "Python 3.11 on DGX OS" constraint was for conda/system
|
||||
# installs; uv provisions 3.12 and all aarch64 cp312 wheels exist now
|
||||
notes = notes + [
|
||||
"DGX OS / Grace detected: using %s wheels and dgx_requirements.txt."
|
||||
% flavor
|
||||
]
|
||||
|
||||
extras = [TORCHCODEC]
|
||||
optional = [FLA]
|
||||
@@ -340,7 +330,6 @@ def _cuda_spec(detection):
|
||||
TORCH,
|
||||
torch_index=PYTORCH_INDEX + flavor,
|
||||
python_version=python_version,
|
||||
requirements_file=requirements,
|
||||
extra_packages=extras,
|
||||
optional_packages=optional,
|
||||
find_links=find_links,
|
||||
|
||||
Reference in new issue
Block a user