Get the library paths required to build a C++ or CUDA extension. Args: cuda: If `True`, includes CUDA-specific library paths. Returns: A list of library path strings.
(cuda: bool = False)
| 1176 | |
| 1177 | |
| 1178 | def library_paths(cuda: bool = False) -> List[str]: |
| 1179 | """ |
| 1180 | Get the library paths required to build a C++ or CUDA extension. |
| 1181 | |
| 1182 | Args: |
| 1183 | cuda: If `True`, includes CUDA-specific library paths. |
| 1184 | |
| 1185 | Returns: |
| 1186 | A list of library path strings. |
| 1187 | """ |
| 1188 | # We need to link against libtorch.so |
| 1189 | paths = [TORCH_LIB_PATH] |
| 1190 | |
| 1191 | if cuda and IS_HIP_EXTENSION: |
| 1192 | lib_dir = 'lib' |
| 1193 | paths.append(_join_rocm_home(lib_dir)) |
| 1194 | if HIP_HOME is not None: |
| 1195 | paths.append(os.path.join(HIP_HOME, 'lib')) |
| 1196 | elif cuda: |
| 1197 | if IS_WINDOWS: |
| 1198 | lib_dir = os.path.join('lib', 'x64') |
| 1199 | else: |
| 1200 | lib_dir = 'lib64' |
| 1201 | if (not os.path.exists(_join_cuda_home(lib_dir)) and |
| 1202 | os.path.exists(_join_cuda_home('lib'))): |
| 1203 | # 64-bit CUDA may be installed in 'lib' (see e.g. gh-16955) |
| 1204 | # Note that it's also possible both don't exist (see |
| 1205 | # _find_cuda_home) - in that case we stay with 'lib64'. |
| 1206 | lib_dir = 'lib' |
| 1207 | |
| 1208 | paths.append(_join_cuda_home(lib_dir)) |
| 1209 | if CUDNN_HOME is not None: |
| 1210 | paths.append(os.path.join(CUDNN_HOME, lib_dir)) |
| 1211 | return paths |
| 1212 | |
| 1213 | |
| 1214 | def load(name, |
no test coverage detected
searching dependent graphs…