Skip to content

Commit

Permalink
[FRONTEND] Handle LD_LIBRARY_PATH (#2892)
Browse files Browse the repository at this point in the history
cherry-pick into release/2.2.x branch.

If `libcuda.so` can not be found using `ldconfig -P`, check if
`LD_LIBRARY_PATH` environment variable is defined and search for it
there

Test plan:

https://colab.research.google.com/drive/16Kd88j-nFS4iMI-UfJS5rukH42L6UuyP?usp=sharing

Fixes #2507

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
  • Loading branch information
atalman and malfet authored Jan 8, 2024
1 parent 54bba97 commit 0e7b97b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/triton/common/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def libcuda_dirs():
# libcuda.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so.1
locs = [line.split()[-1] for line in libs.splitlines() if "libcuda.so" in line]
dirs = [os.path.dirname(loc) for loc in locs]
env_ld_library_path = os.getenv("LD_LIBRARY_PATH")
if env_ld_library_path and not dirs:
dirs = [dir for dir in env_ld_library_path.split(":") if os.path.exists(os.path.join(dir, "libcuda.so"))]
msg = 'libcuda.so cannot found!\n'
if locs:
msg += 'Possible files are located at %s.' % str(locs)
Expand Down

0 comments on commit 0e7b97b

Please sign in to comment.