Skip to content

Commit 009439c

Browse files
authored
Simplify logic of locating CUDART so file path (#13203)
Signed-off-by: Lu Fang <lufang@fb.com>
1 parent bc55d13 commit 009439c

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

vllm/distributed/device_communicators/cuda_wrapper.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import ctypes
8-
import glob
98
from dataclasses import dataclass
109
from typing import Any, Dict, List, Optional
1110

@@ -62,29 +61,6 @@ def find_loaded_library(lib_name) -> Optional[str]:
6261
return path
6362

6463

65-
def get_cudart_lib_path_from_env() -> Optional[str]:
66-
"""
67-
In some system, find_loaded_library() may not work. So we allow users to
68-
specify the path through environment variable VLLM_CUDART_SO_PATH.
69-
"""
70-
cudart_so_env = envs.VLLM_CUDART_SO_PATH
71-
if cudart_so_env is not None:
72-
cudart_paths = [
73-
cudart_so_env,
74-
]
75-
for path in cudart_paths:
76-
file_paths = glob.glob(path)
77-
if len(file_paths) > 0:
78-
logger.info(
79-
"Found cudart library at %s through env var"
80-
"VLLM_CUDART_SO_PATH=%s",
81-
file_paths[0],
82-
cudart_so_env,
83-
)
84-
return file_paths[0]
85-
return None
86-
87-
8864
class CudaRTLibrary:
8965
exported_functions = [
9066
# ​cudaError_t cudaSetDevice ( int device )
@@ -131,7 +107,7 @@ def __init__(self, so_file: Optional[str] = None):
131107
if so_file is None:
132108
so_file = find_loaded_library("libcudart")
133109
if so_file is None:
134-
so_file = get_cudart_lib_path_from_env()
110+
so_file = envs.VLLM_CUDART_SO_PATH # fallback to env var
135111
assert so_file is not None, \
136112
(
137113
"libcudart is not loaded in the current process, "

0 commit comments

Comments
 (0)