Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix library detection #873

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

wkpark
Copy link
Contributor

@wkpark wkpark commented Nov 15, 2023

fix library detection

manually cherry-picked from PR #788

See also #876

@wkpark wkpark force-pushed the lib-windows branch 2 times, most recently from b27420e to 0961eba Compare November 16, 2023 14:01
@wkpark wkpark force-pushed the lib-windows branch 3 times, most recently from 1a8d409 to c1d3209 Compare December 13, 2023 05:03
@wkpark
Copy link
Contributor Author

wkpark commented Dec 13, 2023

rebased. fix some mistakes. partial squashed.

Copy link
Collaborator

@TimDettmers TimDettmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR! Overall it looks very good. There are some issues that I would like more information on but I think we would be able to merge this without any major issues.

@@ -46,26 +32,31 @@ def generate_bug_report_information():
print('')

if 'CONDA_PREFIX' in os.environ:
paths = find_file_recursive(os.environ['CONDA_PREFIX'], '*cuda*so')
paths = find_file_recursive(os.environ['CONDA_PREFIX'], '*cuda*')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure that this does not match non-binary files. How can we make sure that this is correct in most environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dll, so, or dylib ext part appended later in the find_file_recursive()


return out
return outs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the list instead of path cause errors in some edge cases? As I understand it, we either have dll or dylib, is that correct? Or can we have both in some cases?

bitsandbytes/__main__.py Show resolved Hide resolved
bitsandbytes/__main__.py Outdated Show resolved Hide resolved
bitsandbytes/cuda_setup/env_vars.py Show resolved Hide resolved
bitsandbytes/cuda_setup/main.py Outdated Show resolved Hide resolved
@@ -111,7 +118,9 @@ def manual_override(self):
'For example by adding the following to your .bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to_cuda_dir/lib64\n'
f'Loading CUDA version: BNB_CUDA_VERSION={os.environ["BNB_CUDA_VERSION"]}'
f'\n{"="*80}\n\n'))
self.binary_name = self.binary_name[:-6] + f'{os.environ["BNB_CUDA_VERSION"]}.so'
binary_name = self.binary_name.rsplit(".", 1)[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a mess (based on my messy previous code). I have not looked at the details. Is there a way where we can clean this up slightly?

@wkpark wkpark force-pushed the lib-windows branch 2 times, most recently from 10c8f41 to 6dae722 Compare January 2, 2024 08:29
@wkpark
Copy link
Contributor Author

wkpark commented Jan 2, 2024

rebased with some fixes.

@wkpark wkpark mentioned this pull request Jan 2, 2024
@wkpark
Copy link
Contributor Author

wkpark commented Jan 24, 2024

rebased, partial squashed, conflict resolved

@Titus-von-Koeller Titus-von-Koeller self-assigned this Jan 25, 2024
@Titus-von-Koeller Titus-von-Koeller added CUDA Setup high priority (first issues that will be worked on) Windows labels Jan 25, 2024
@Titus-von-Koeller
Copy link
Collaborator

Titus-von-Koeller commented Jan 26, 2024

@wkpark Thanks a lot for the nice PR and your continuing great work around bnb, despite frustrations! The code looks really good. From what I can see the changes are mostly in the reporting part and therefore not risky. The other changes are very minimal and seem unproblematic by visual inspection.

I think we can take the risk to merge this. I wish we had a better way of testing the setup module though. It would profit from further refactors and that would make it easier.

Thanks for your valuable contribution!

@Titus-von-Koeller Titus-von-Koeller merged commit e651e8e into bitsandbytes-foundation:main Jan 26, 2024
1 check failed
out = glob.glob(os.path.join(folder, "**", filename + ext))
outs.extend(out)
except Exception as e:
raise RuntimeError('Error: Something when wrong when trying to find file. {e}')
Copy link
Contributor

@akx akx Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing an f so the exception is never printed. (That's fixed in #984.)

This was referenced Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUDA Setup high priority (first issues that will be worked on) Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants