Daankular commited on
Commit
9e792e6
·
1 Parent(s): 2bab2fb

Fix CUDA compile: set TORCH_CUDA_ARCH_LIST=8.6 and CUDA headers path for A10G

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -63,9 +63,21 @@ def _install_runtime_packages():
63
  [sys.executable, "-m", "pip", "install", "--quiet", "--no-deps"]
64
  + _NO_DEPS_PACKAGES, check=True,
65
  )
 
 
 
 
 
 
 
 
 
 
 
 
66
  subprocess.run(
67
  [sys.executable, "-m", "pip", "install", "--quiet", "--no-build-isolation"]
68
- + _CUDA_PACKAGES, check=True,
69
  )
70
  _RUNTIME_PKG_MARKER.touch()
71
  print("[startup] Runtime packages installed.")
 
63
  [sys.executable, "-m", "pip", "install", "--quiet", "--no-deps"]
64
  + _NO_DEPS_PACKAGES, check=True,
65
  )
66
+ # A10G = sm_86. Set arch list explicitly because NVML is unavailable at install
67
+ # time (no GPU allocated yet), so torch can't auto-detect it.
68
+ # CUDA headers live at a non-standard path on ZeroGPU runtime containers.
69
+ _cuda_home = "/cuda-image/usr/local/cuda-12.9"
70
+ _cuda_env = {
71
+ **os.environ,
72
+ "TORCH_CUDA_ARCH_LIST": "8.6",
73
+ "CUDA_HOME": _cuda_home,
74
+ "CPATH": f"{_cuda_home}/include:{os.environ.get('CPATH', '')}",
75
+ "C_INCLUDE_PATH": f"{_cuda_home}/include:{os.environ.get('C_INCLUDE_PATH', '')}",
76
+ "CPLUS_INCLUDE_PATH": f"{_cuda_home}/include:{os.environ.get('CPLUS_INCLUDE_PATH', '')}",
77
+ }
78
  subprocess.run(
79
  [sys.executable, "-m", "pip", "install", "--quiet", "--no-build-isolation"]
80
+ + _CUDA_PACKAGES, env=_cuda_env, check=True,
81
  )
82
  _RUNTIME_PKG_MARKER.touch()
83
  print("[startup] Runtime packages installed.")