cuda: sleep 30s instead of poll-fail; let model load handle lazy init
Browse files- scripts/bold_pipeline.py +9 -18
scripts/bold_pipeline.py
CHANGED
|
@@ -22,28 +22,19 @@ import random
|
|
| 22 |
import sys
|
| 23 |
from pathlib import Path
|
| 24 |
|
| 25 |
-
def _wait_for_cuda(
|
| 26 |
import time as _t
|
|
|
|
|
|
|
| 27 |
try:
|
| 28 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
except Exception as e:
|
| 30 |
-
|
| 31 |
-
for i in range(max_tries):
|
| 32 |
-
try:
|
| 33 |
-
try:
|
| 34 |
-
torch.cuda.init()
|
| 35 |
-
except Exception:
|
| 36 |
-
pass
|
| 37 |
-
n = torch.cuda.device_count()
|
| 38 |
-
if n > 0:
|
| 39 |
-
_ = torch.zeros(1, device="cuda")
|
| 40 |
-
print(f"[cuda] ready after {i*2}s: {n} device(s), {torch.cuda.get_device_name(0)}", flush=True)
|
| 41 |
-
return
|
| 42 |
-
except Exception as e:
|
| 43 |
-
if i % 5 == 0:
|
| 44 |
-
print(f"[cuda] wait {i}/{max_tries}: {type(e).__name__}: {str(e)[:120]}", flush=True)
|
| 45 |
-
_t.sleep(2)
|
| 46 |
-
raise RuntimeError(f"CUDA never became ready after {max_tries*2}s — likely bad H200 node, retry job")
|
| 47 |
|
| 48 |
|
| 49 |
def _setup_workdir():
|
|
|
|
| 22 |
import sys
|
| 23 |
from pathlib import Path
|
| 24 |
|
| 25 |
+
def _wait_for_cuda():
|
| 26 |
import time as _t
|
| 27 |
+
print("[cuda] sleeping 30s for driver init...", flush=True)
|
| 28 |
+
_t.sleep(30)
|
| 29 |
try:
|
| 30 |
import torch
|
| 31 |
+
n = torch.cuda.device_count() if torch.cuda.is_available() else 0
|
| 32 |
+
if n > 0:
|
| 33 |
+
print(f"[cuda] ready: {n} device(s), {torch.cuda.get_device_name(0)}", flush=True)
|
| 34 |
+
else:
|
| 35 |
+
print("[cuda] device_count=0 after sleep — letting model load trigger lazy init", flush=True)
|
| 36 |
except Exception as e:
|
| 37 |
+
print(f"[cuda] probe error (non-fatal, model load will retry): {e}", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
def _setup_workdir():
|