From 6e0f84d44d19651446e1ecb197f6e583426a47fc Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Wed, 7 Feb 2024 04:59:33 +0900 Subject: [PATCH] HOTFIX: Fix regression (cpu fix) (#1038) * add "_cpu" tag correctly (regression) * add lib suffix ".dylib" for Darwin Co-authored-by: Aarni Koskela --------- Co-authored-by: Aarni Koskela --- CMakeLists.txt | 2 +- bitsandbytes/cuda_setup/main.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a4090bb7..1b9f1854b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ elseif(BUILD_MPS) VERBATIM) add_custom_target(metallib DEPENDS "bitsandbytes/bitsandbytes.metallib") else() - set(LIBSUFFIX "cpu") + string(APPEND BNB_OUTPUT_NAME "_cpu") set(GPU_SOURCES) endif() diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index 4245a2842..14c7abbd8 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -28,16 +28,15 @@ from .env_vars import get_potentially_lib_path_containing_env_vars -if platform.system() == 'Windows': # Windows +DYNAMIC_LIBRARY_SUFFIX = { "Darwin": ".dylib", "Windows": ".dll", "Linux": ".so"}.get(platform.system(), ".so") +if platform.system() == "Windows": # Windows CUDA_RUNTIME_LIBS = ["nvcuda.dll"] - DYNAMIC_LIBRARY_SUFFIX = ".dll" else: # Linux or other # these are the most common libs names # libcudart.so is missing by default for a conda install with PyTorch 2.0 and instead # we have libcudart.so.11.0 which causes a lot of errors before # not sure if libcudart.so.12.0 exists in pytorch installs, but it does not hurt CUDA_RUNTIME_LIBS = ["libcudart.so", "libcudart.so.11.0", "libcudart.so.12.0", "libcudart.so.12.1", "libcudart.so.12.2"] - DYNAMIC_LIBRARY_SUFFIX = ".so" class CUDASetup: