vllm.distributed.device_communicators.cuda_wrapper
This file is a pure Python wrapper for the cudart library. It avoids the need to compile a separate shared library, and is convenient for use when we just need to call a few functions.
CudaRTLibrary
¶
Source code in vllm/distributed/device_communicators/cuda_wrapper.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
exported_functions
class-attribute
instance-attribute
¶
exported_functions = [
Function("cudaSetDevice", cudaError_t, [c_int]),
Function("cudaDeviceSynchronize", cudaError_t, []),
Function("cudaDeviceReset", cudaError_t, []),
Function("cudaGetErrorString", c_char_p, [cudaError_t]),
Function(
"cudaMalloc",
cudaError_t,
[POINTER(c_void_p), c_size_t],
),
Function("cudaFree", cudaError_t, [c_void_p]),
Function(
"cudaMemset",
cudaError_t,
[c_void_p, c_int, c_size_t],
),
Function(
"cudaMemcpy",
cudaError_t,
[c_void_p, c_void_p, c_size_t, cudaMemcpyKind],
),
Function(
"cudaIpcGetMemHandle",
cudaError_t,
[POINTER(cudaIpcMemHandle_t), c_void_p],
),
Function(
"cudaIpcOpenMemHandle",
cudaError_t,
[POINTER(c_void_p), cudaIpcMemHandle_t, c_uint],
),
]
path_to_dict_mapping
class-attribute
instance-attribute
¶
path_to_library_cache
class-attribute
instance-attribute
¶
CUDART_CHECK
¶
CUDART_CHECK(result: cudaError_t) -> None
__init__
¶
Source code in vllm/distributed/device_communicators/cuda_wrapper.py
cudaDeviceReset
¶
cudaDeviceSynchronize
¶
cudaGetErrorString
¶
cudaGetErrorString(error: cudaError_t) -> str
cudaIpcGetMemHandle
¶
cudaIpcGetMemHandle(devPtr: c_void_p) -> cudaIpcMemHandle_t
cudaIpcOpenMemHandle
¶
cudaIpcOpenMemHandle(
handle: cudaIpcMemHandle_t,
) -> c_void_p
Source code in vllm/distributed/device_communicators/cuda_wrapper.py
cudaMalloc
¶
cudaMemcpy
¶
cudaMemset
¶
Function
dataclass
¶
Source code in vllm/distributed/device_communicators/cuda_wrapper.py
cudaIpcMemHandle_t
¶
find_loaded_library
¶
According to according to https://man7.org/linux/man-pages/man5/proc_pid_maps.5.html,
the file /proc/self/maps
contains the memory maps of the process, which includes the
shared libraries loaded by the process. We can use this file to find the path of the
a loaded library.