From c584482f1f13e073dac714815f2d439fd66699d1 Mon Sep 17 00:00:00 2001 From: Tom Aarsen Date: Wed, 26 Oct 2022 09:37:16 +0200 Subject: Resolve cases of CUDASetup.get_instance not being called when used --- bitsandbytes/cuda_setup/main.py | 4 ++-- bitsandbytes/cuda_setup/paths.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index f5abda2..8a5e25c 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -27,14 +27,14 @@ def check_cuda_result(cuda, result_val): if result_val != 0: error_str = ctypes.c_char_p() cuda.cuGetErrorString(result_val, ctypes.byref(error_str)) - CUDASetup.get_instance.add_log_entry(f"CUDA exception! Error code: {error_str.value.decode()}") + CUDASetup.get_instance().add_log_entry(f"CUDA exception! Error code: {error_str.value.decode()}") def get_cuda_version(cuda, cudart_path): # https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART____VERSION.html#group__CUDART____VERSION try: cudart = ctypes.CDLL(cudart_path) except OSError: - CUDASetup.get_instance.add_log_entry(f'ERROR: libcudart.so could not be read from path: {cudart_path}!') + CUDASetup.get_instance().add_log_entry(f'ERROR: libcudart.so could not be read from path: {cudart_path}!') return None version = ctypes.c_int() diff --git a/bitsandbytes/cuda_setup/paths.py b/bitsandbytes/cuda_setup/paths.py index 3223359..3a5e65d 100644 --- a/bitsandbytes/cuda_setup/paths.py +++ b/bitsandbytes/cuda_setup/paths.py @@ -61,7 +61,7 @@ def warn_in_case_of_duplicates(results_paths: Set[Path]) -> None: "If you get `CUDA error: invalid device function` errors, the above " "might be the cause and the solution is to make sure only one " f"{CUDA_RUNTIME_LIB} in the paths that we search based on your env.") - CUDASetup.get_instance.add_log_entry(warning_msg, is_warning=True) + CUDASetup.get_instance().add_log_entry(warning_msg, is_warning=True) def determine_cuda_runtime_lib_path() -> Union[Path, None]: @@ -87,7 +87,7 @@ def determine_cuda_runtime_lib_path() -> Union[Path, None]: if conda_cuda_libs: return next(iter(conda_cuda_libs)) - CUDASetup.get_instance.add_log_entry(f'{candidate_env_vars["CONDA_PREFIX"]} did not contain ' + CUDASetup.get_instance().add_log_entry(f'{candidate_env_vars["CONDA_PREFIX"]} did not contain ' f'{CUDA_RUNTIME_LIB} as expected! Searching further paths...', is_warning=True) if "LD_LIBRARY_PATH" in candidate_env_vars: -- cgit v1.2.3 From 4faf6cb7e983a7ceb32b6329a597e26748dc3977 Mon Sep 17 00:00:00 2001 From: Tom Aarsen Date: Wed, 26 Oct 2022 09:43:57 +0200 Subject: Replace seemingly incorrect use of CUDA_RUNTIME_LIB --- bitsandbytes/cuda_setup/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index 8a5e25c..8fdaec0 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -54,7 +54,7 @@ def get_cuda_lib_handle(): try: cuda = ctypes.CDLL("libcuda.so") except OSError: - CUDA_RUNTIME_LIB.get_instance().add_log_entry('CUDA SETUP: WARNING! 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!') + CUDASetup.get_instance().add_log_entry('CUDA SETUP: WARNING! 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)) -- cgit v1.2.3