Skip to content

Commit 0f4f2a6

Browse files
committed
fix threaded compile issue
1 parent 66d976f commit 0f4f2a6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import torch
1212
import torch.nn.functional as F
1313
import torchvision
14+
from concurrent.futures import ThreadPoolExecutor
1415

1516
from world_engine import WorldEngine, CtrlInput, QUANTS
1617

@@ -424,6 +425,15 @@ async def main(
424425
device: str = "cuda",
425426
quant: str | None = None,
426427
) -> None:
428+
429+
# warmup cublas
430+
asyncio.get_running_loop().set_default_executor(ThreadPoolExecutor(max_workers=1))
431+
432+
def _cuda_warmup() -> None:
433+
with torch.cuda.device(device):
434+
torch.cuda.current_blas_handle()
435+
await asyncio.to_thread(_cuda_warmup)
436+
427437
seed = None
428438

429439
engine = WorldEngine(

0 commit comments

Comments
 (0)