A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
Remove unused find_cuda_init helper script (#25044)
Simon Mo committed
Sep 17, 2025 at 09:47 UTC
d6a518fdde9780f5c9aabe8cf1f2fafd29af3cbc
1 file changed
-36
find_cuda_init.py
deleted
-36
@@ -1,36 +0,0 @@
1
-# SPDX-License-Identifier: Apache-2.0
2
-# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-
4
-import importlib
5
-import traceback
6
-from typing import Callable
7
-from unittest.mock import patch
8
-
9
-
10
-def find_cuda_init(fn: Callable[[], object]) -> None:
11
- """
12
- Helper function to debug CUDA re-initialization errors.
13
-
14
- If `fn` initializes CUDA, prints the stack trace of how this happens.
15
- """
16
- from torch.cuda import _lazy_init
17
-
18
- stack = None
19
-
20
- def wrapper():
21
- nonlocal stack
22
- stack = traceback.extract_stack()
23
- return _lazy_init()
24
-
25
- with patch("torch.cuda._lazy_init", wrapper):
26
- fn()
27
-
28
- if stack is not None:
29
- print("==== CUDA Initialized ====")
30
- print("".join(traceback.format_list(stack)).strip())
31
- print("==========================")
32
-
33
-
34
-if __name__ == "__main__":
35
- find_cuda_init(
36
- lambda: importlib.import_module("vllm.model_executor.models.llava"))