-
Notifications
You must be signed in to change notification settings - Fork 214
Add LoadedDL.found_via
#1049
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
Add LoadedDL.found_via
#1049
Changes from all commits
599ef39
b5d53c0
8746a22
bf44cdf
95d913c
9c5a059
7557d50
711179f
96574e5
936cd20
4f1abfd
a969731
8df1369
f7994fc
d0b9d65
e02bf25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,14 @@ | |
def _load_lib_no_cache(libname: str) -> LoadedDL: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect it'll be simpler (less code) to wrap this function in a helper that adds
Alternatively, we could pass |
||
finder = _FindNvidiaDynamicLib(libname) | ||
abs_path = finder.try_site_packages() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor but would be nice: keep the
|
||
if abs_path is None: | ||
|
||
abs_path = finder.try_site_packages() | ||
if abs_path is not None: | ||
found_via = "site-packages" | ||
else: | ||
abs_path = finder.try_with_conda_prefix() | ||
if abs_path is not None: | ||
found_via = "conda" | ||
|
||
# If the library was already loaded by someone else, reproduce any OS-specific | ||
# side-effects we would have applied on a direct absolute-path load (e.g., | ||
|
@@ -49,8 +55,10 @@ def _load_lib_no_cache(libname: str) -> LoadedDL: | |
abs_path = finder.try_with_cuda_home() | ||
if abs_path is None: | ||
finder.raise_not_found_error() | ||
else: | ||
found_via = "CUDA_HOME" | ||
|
||
return load_with_abs_path(libname, abs_path) | ||
return load_with_abs_path(libname, abs_path, found_via) | ||
|
||
|
||
@functools.cache | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
__version__ = "1.3.1a0" | ||
__version__ = "1.3.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to move this below the
class _LoadNvidiaDynamicLib
code (it's more in line with how I organized the rest of the pathfinder code).Also, this could be a one-liner: