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 libkvikio.so, use RTLD_LOCAL #551

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

jameslamb
Copy link
Member

Description

Contributes to rapidsai/build-planning#118

Modifies libkvikio.load_library() in the following ways:

  • prefer wheel-provided libkvikio.so to system installation
  • expose environment variable RAPIDS_LIBKVIKIO_PREFER_SYSTEM_LIBRARY for switching that preference
  • load libkvikio.so with RTLD_LOCAL, to prevent adding symbols to the global namespace (dlopen docs)

Notes for Reviewers

How I tested this

Tested the general approach on rapidsai/cudf#17316 and rapidsai/cuspatial#1483.

@jameslamb jameslamb added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Nov 14, 2024
@jameslamb jameslamb changed the title WIP: [DO NOT MERGE] prefer wheel-provided libvkikio.so, use RTLD_LOCAL WIP: [DO NOT MERGE] prefer wheel-provided libkvikio.so, use RTLD_LOCAL Nov 14, 2024
@jameslamb jameslamb changed the title WIP: [DO NOT MERGE] prefer wheel-provided libkvikio.so, use RTLD_LOCAL prefer wheel-provided libkvikio.so, use RTLD_LOCAL Nov 14, 2024
@jameslamb jameslamb requested a review from vyasr November 14, 2024 22:35
@jameslamb jameslamb marked this pull request as ready for review November 14, 2024 22:35
@jameslamb jameslamb requested a review from a team as a code owner November 14, 2024 22:35
@jameslamb
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit f1ad8b9 into rapidsai:branch-24.12 Nov 14, 2024
54 checks passed
@jameslamb jameslamb deleted the library-loading branch November 14, 2024 23:29
rapids-bot bot pushed a commit that referenced this pull request Nov 15, 2024
Contributes to rapidsai/build-planning#118

The pattern introduced in #551 breaks editable installs in devcontainers. In that type of build, `libkvikio.so` is built outside of the wheel but **not installed**, so it can't be found by `ld`. Extension modules in `kvikio` are able to find it via RPATHs instead.

This proposes:

* try-catching the entire library-loading attempt, to silently do nothing in cases like that
* adding an import of the `kvikio` Python library in the `devcontainers` CI job, as a smoke test to catch issues like this in the future

## Notes for Reviewers

### How I tested this

Reproduced that with the CUDA 12.5 pip devcontainers today:

```shell
build-all
python -c "import kvikio"
# OSError: libkvikio.so: cannot open shared object file: No such file or directory
```

Confirmed that the changes in this PR fix that.

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants