diff options
author | Tim Dettmers <tim.dettmers@gmail.com> | 2022-08-16 19:03:19 -0700 |
---|---|---|
committer | Tim Dettmers <tim.dettmers@gmail.com> | 2022-08-16 19:03:19 -0700 |
commit | a6664de0720c7d8572a475a9c59f7dd85b5f83b0 (patch) | |
tree | 1342a757dfc60fe37f1d94371251fd17bc968bff /bitsandbytes | |
parent | de354f7ded52bfa857089769225cdf1ee694bfd6 (diff) |
Enhanced error handling in CUDA SETUP failures.
Diffstat (limited to 'bitsandbytes')
-rw-r--r-- | bitsandbytes/cextension.py | 13 | ||||
-rw-r--r-- | bitsandbytes/cuda_setup/main.py | 11 |
2 files changed, 15 insertions, 9 deletions
diff --git a/bitsandbytes/cextension.py b/bitsandbytes/cextension.py index e0f280a..af23c8f 100644 --- a/bitsandbytes/cextension.py +++ b/bitsandbytes/cextension.py @@ -17,12 +17,17 @@ class CUDALibrary_Singleton(object): binary_path = package_dir / binary_name if not binary_path.exists(): - print(f"CUDA_SETUP: TODO: compile library for specific version: {binary_name}") + print(f"CUDA SETUP: TODO: compile library for specific version: {binary_name}") legacy_binary_name = "libbitsandbytes.so" - print(f"CUDA_SETUP: Defaulting to {legacy_binary_name}...") - self.lib = ct.cdll.LoadLibrary(package_dir / legacy_binary_name) + print(f"CUDA SETUP: Defaulting to {legacy_binary_name}...") + binary_path = package_dir / legacy_binary_name + if not binary_path.exists(): + print('CUDA SETUP: CUDA detection failed. Either CUDA driver not installed, CUDA not installed, or you have multiple conflicting CUDA libraries!') + print('CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.') + raise Exception('CUDA SETUP: Setup Failed!') + self.lib = ct.cdll.LoadLibrary(binary_path) else: - print(f"CUDA_SETUP: Loading binary {binary_path}...") + print(f"CUDA SETUP: Loading binary {binary_path}...") self.lib = ct.cdll.LoadLibrary(binary_path) @classmethod diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index 1f2ceb4..975b772 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -46,7 +46,7 @@ def get_cuda_version(cuda, cudart_path): minor = (version-(major*1000))//10 if major < 11: - print('CUDA SETUP: CUDA version lower than 11 are currenlty not supported!') + print('CUDA SETUP: CUDA version lower than 11 are currenlty not supported for LLM.int8(). You will be only to use 8-bit optimizers and quantization routines!!') return f'{major}{minor}' @@ -57,7 +57,7 @@ def get_cuda_lib_handle(): cuda = ctypes.CDLL("libcuda.so") except OSError: # TODO: shouldn't we error or at least warn here? - print('ERROR: libcuda.so not found!') + raise Exception('CUDA SETUP: ERROR! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!') return None check_cuda_result(cuda, cuda.cuInit(0)) @@ -115,7 +115,8 @@ def get_compute_capability(cuda): def evaluate_cuda_setup(): print('') print('='*35 + 'BUG REPORT' + '='*35) - print('Welcome to bitsandbytes. For bug reports, please use this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link') + print('Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues') + print('For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link') print('='*80) binary_name = "libbitsandbytes_cpu.so" cudart_path = determine_cuda_runtime_lib_path() @@ -125,7 +126,7 @@ def evaluate_cuda_setup(): ) return binary_name - print(f"CUDA SETUP: CUDA path found: {cudart_path}") + print(f"CUDA SETUP: CUDA runtime path found: {cudart_path}") cuda = get_cuda_lib_handle() cc = get_compute_capability(cuda) print(f"CUDA SETUP: Highest compute capability among GPUs detected: {cc}") @@ -147,7 +148,7 @@ def evaluate_cuda_setup(): # we use ls -l instead of nvcc to determine the cuda version # since most installations will have the libcudart.so installed, but not the compiler - print(f'CUDA_SETUP: Detected CUDA version {cuda_version_string}') + print(f'CUDA SETUP: Detected CUDA version {cuda_version_string}') def get_binary_name(): "if not has_cublaslt (CC < 7.5), then we have to choose _nocublaslt.so" |