From cda209fab674b35abd37a7f33a79ac3588f58ad5 Mon Sep 17 00:00:00 2001 From: Gil Emmanuel Bancud Date: Wed, 12 Jul 2023 01:13:08 +0800 Subject: [PATCH 1/3] Get library paths from LD_Library path --- bitsandbytes/cuda_setup/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index e7901d82e..30a9b81aa 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -111,7 +111,16 @@ def run_cuda_setup(self): package_dir = Path(__file__).parent.parent binary_path = package_dir / binary_name - print('bin', binary_path) + if not binary_path.exists(): + # If binary file does not exist, check LD_LIBRARY_PATH + library_paths = os.getenv("LD_LIBRARY_PATH", "").split(":") + for path in library_paths: + potential_binary_path = Path(path) / binary_name + if potential_binary_path.exists(): + binary_path = potential_binary_path + break + + print("bin", binary_path) try: if not binary_path.exists(): From 346d366933b10f6430e7e849f8e3ee9840db2dd8 Mon Sep 17 00:00:00 2001 From: Gil Emmanuel Bancud Date: Wed, 12 Jul 2023 01:36:40 +0800 Subject: [PATCH 2/3] Add debug print --- bitsandbytes/cuda_setup/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index 30a9b81aa..70b195d17 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -114,10 +114,13 @@ def run_cuda_setup(self): if not binary_path.exists(): # If binary file does not exist, check LD_LIBRARY_PATH library_paths = os.getenv("LD_LIBRARY_PATH", "").split(":") + print("library_paths ", library_paths) for path in library_paths: potential_binary_path = Path(path) / binary_name + print("potential_binary_path", potential_binary_path) if potential_binary_path.exists(): binary_path = potential_binary_path + print("binary_path", binary_path) break print("bin", binary_path) From 5bad2d922126d9c8498cdb6e20b0afca502bf971 Mon Sep 17 00:00:00 2001 From: Gil Emmanuel Bancud Date: Wed, 12 Jul 2023 01:44:35 +0800 Subject: [PATCH 3/3] fix index error --- bitsandbytes/cuda_setup/main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bitsandbytes/cuda_setup/main.py b/bitsandbytes/cuda_setup/main.py index 70b195d17..562baa44b 100644 --- a/bitsandbytes/cuda_setup/main.py +++ b/bitsandbytes/cuda_setup/main.py @@ -115,13 +115,13 @@ def run_cuda_setup(self): # If binary file does not exist, check LD_LIBRARY_PATH library_paths = os.getenv("LD_LIBRARY_PATH", "").split(":") print("library_paths ", library_paths) - for path in library_paths: - potential_binary_path = Path(path) / binary_name - print("potential_binary_path", potential_binary_path) - if potential_binary_path.exists(): - binary_path = potential_binary_path - print("binary_path", binary_path) - break + for path in library_paths: + potential_binary_path = Path(path) / binary_name + print("potential_binary_path", potential_binary_path) + if potential_binary_path.exists(): + binary_path = potential_binary_path + print("binary_path", binary_path) + break print("bin", binary_path)