@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 009439caeb
Fork 0

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 15, 23:30 UTC

Simplify logic of locating CUDART so file path (#13203)

Signed-off-by: Lu Fang <lufang@fb.com>

Lu Fang committed Feb 12, 2025 at 21:52 UTC 009439caeb3ae27d1d6c94e550eee13bbd0520af
1 file changed +1 -25
vllm/distributed/device_communicators/cuda_wrapper.py
+1 -25
@@ -5,7 +5,6 @@ convenient for use when we just need to call a few functions.
5 """
6
7 import ctypes
8 -import glob
8 from dataclasses import dataclass
9 from typing import Any, Dict, List, Optional
10
@@ -62,29 +61,6 @@ def find_loaded_library(lib_name) -> Optional[str]:
61 return path
62
63
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 -
64 class CudaRTLibrary:
65 exported_functions = [
66 # ​cudaError_t cudaSetDevice ( int device )
@@ -131,7 +107,7 @@ class CudaRTLibrary:
107 if so_file is None:
108 so_file = find_loaded_library("libcudart")
109 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
111 assert so_file is not None, \
112 (
113 "libcudart is not loaded in the current process, "