Skip to content

Commit

Permalink
CUDA setup: make version number replacement logic more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Feb 1, 2024
1 parent 5adf653 commit a724c05
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bitsandbytes/cuda_setup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ def manual_override(self):
if not override_value:
return

binary_name = self.binary_name.rsplit(".", 1)[0]
# TODO: what's the magic value `-3` here?
self.binary_name = binary_name[:-3] + f'{override_value}{DYNAMIC_LIBRARY_SUFFIX}'
binary_name_stem, _, binary_name_ext = self.binary_name.rpartition(".")
# `binary_name_stem` will now be e.g. `/foo/bar/libbitsandbytes_cuda118`;
# let's remove any trailing numbers:
binary_name_stem = binary_name_stem.rstrip("0123456789")
# `binary_name_stem` will now be e.g. `/foo/bar/libbitsandbytes_cuda`;
# let's tack the new version number and the original extension back on.
self.binary_name = f"{binary_name_stem}{override_value}.{binary_name_ext}"

warn(
f'\n\n{"=" * 80}\n'
Expand Down

0 comments on commit a724c05

Please sign in to comment.