Spaces:
Running on Zero
Running on Zero
Commit ·
5ed2ecb
1
Parent(s): 9acf075
Use cudaMallocAsync allocator to fix MIG GPU CUDACachingAllocator crash
Browse filesPyTorch's default CUDA Caching Allocator makes NVML memory queries
(nvmlDeviceGetMemoryInfo) that fail on MIG GPU instances running as
non-root, causing: NVML_SUCCESS == r INTERNAL ASSERT FAILED at
CUDACachingAllocator.cpp:1165. The cudaMallocAsync backend avoids
these NVML queries entirely.
Set via PYTORCH_CUDA_ALLOC_CONF at module level (before any CUDA init)
so it is inherited by ZeroGPU's subprocess.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -4,6 +4,9 @@ import time
|
|
| 4 |
import threading
|
| 5 |
import traceback
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
import numpy as np
|
| 9 |
import spaces
|
|
|
|
| 4 |
import threading
|
| 5 |
import traceback
|
| 6 |
|
| 7 |
+
# cudaMallocAsync bypasses NVML memory queries that fail on MIG GPU instances
|
| 8 |
+
os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "backend:cudaMallocAsync")
|
| 9 |
+
|
| 10 |
import gradio as gr
|
| 11 |
import numpy as np
|
| 12 |
import spaces
|