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

prefer wheel-provided libcudf.so in load_library(), use RTLD_LOCAL #17316

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
just search lib64, update comment
  • Loading branch information
jameslamb committed Nov 14, 2024
commit 17598fb87fc1ec0d1c815e7b3f7fded565e44ab4
22 changes: 11 additions & 11 deletions python/libcudf/libcudf/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
import ctypes
import os

# RTLD_LOCAL is here for safety... using it loads symbols into the library-specific
# table maintained by the loader, but not into the global namespace where they
# may conflict with symbols from other loaded DSOs.
# Loading with RTLD_LOCAL adds the library itself to the loader's
# loaded library cache without loading any symbols into the global
# namespace. This allows libraries that express a dependency on
# this library to be loaded later and successfully satisfy this dependency
# without polluting the global symbol table with symbols from
# libcuspatial that could conflict with symbols from other DSOs.
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
PREFERRED_LOAD_FLAG = ctypes.RTLD_LOCAL


Expand All @@ -34,14 +37,11 @@ def _load_wheel_installation(soname: str):

Returns ``None`` if the library cannot be loaded.
"""
out = None
for lib_dir in ("lib", "lib64"):
if os.path.isfile(
lib := os.path.join(os.path.dirname(__file__), lib_dir, soname)
):
out = ctypes.CDLL(lib, PREFERRED_LOAD_FLAG)
break
return out
if os.path.isfile(
lib := os.path.join(os.path.dirname(__file__), "lib64", soname)
):
return ctypes.CDLL(lib, PREFERRED_LOAD_FLAG)
return None


def load_library():
Expand Down
Loading