Skip to content

[FEA]: Add find_nvidia_dynamic_library to find the DSO location without loading #757

Open

Description

@leofang

It’d be nice for path finder to gain a capability find_nvidia_dynamic_library, that only returns the DSO location that the path finder would load, but does not actually load it. cuFile and nvJitLink could use this.

Activity

  1. added
    triageNeeds the team's attention
    featureNew feature or request
    cuda.pathfinderEverything related to the cuda.pathfinder module
    on Jul 15, 2025
  2. rwgk commented on Jul 15, 2025

    @rwgk
    Contributor

    I floated this idea a few days ago:

    This could be implemented in a few lines by calling load_nvidia_dynamic_library() in a separate process. This approach guarantees that load_nvidia_dynamic_library() and find_nvidia_dynamic_library() are 100% consistent. All major parts of the functionality needed exist already (in particular https://github.com/NVIDIA/cuda-python/blob/a93b760e01a16c7f80e7b802095a1d4d069c001e/cuda_bindings/tests/spawned_process_runner.py).

  3. kkraus14 commented on Jul 15, 2025

    @kkraus14
    Collaborator

    If a different library loaded in the current process had some RPATH set that influenced where it loaded something from, wouldn't that not be captured in a separate process?

  4. leofang commented on Jul 15, 2025

    @leofang
    MemberAuthor

    Yes I've been thinking about this too. One notable example is how conda Python finds shared libraries via RPATH. nvmath-python currently also uses RPATH. Another potential divergence is if there is another library that already loads what we need, and pathfinder would jus reuse it.

    I think find_nvidia_dynamic_library should present the solution that we would get without being influenced by other DSOs. So in a sense a potential divergence is inevitable.

  5. self-assigned this
    on Jul 18, 2025
  6. changed the title [-]Add `find_nvidia_dynamic_library` to find the DSO location without loading[/-] [+][FEA]: Add `find_nvidia_dynamic_library` to find the DSO location without loading[/+] on Mar 4, 2026
  7. removed this from the cuda.pathfinder backlog milestone on Apr 2, 2026
  8. moved this from Todo to In Progress in CCCLon Apr 26, 2026
  9. added a commit that references this issue on Oct 27, 2026
    5538503
  10. srimanachanta commented on Oct 28, 2026

    @srimanachanta

    I opened #3233 to address this. It builds on @rparolin's #1980.

    #3233 adds find_nvidia_dynamic_lib(libname) -> str and locate_nvidia_dynamic_lib(libname) -> LocatedDynamicLib, matching the existing find_/locate_ pairs for static and bitcode libraries. They return the file load_nvidia_dynamic_lib would load in a fresh process, without loading it into the caller's process.

    From #1980 it keeps the find_nvidia_dynamic_lib name, the error contract and the functools.cache on find_. It also keeps the behavior agreed in this thread: libraries already loaded in the current process don't affect the result.

    The main change is where the search runs. #1980 ran all of load_nvidia_dynamic_lib in a subprocess. #3233 runs the file-based steps (site-packages, conda, CUDA_PATH/CUDA_HOME, Program Files) in the caller's process. It uses the existing canary subprocess only for the native loader search, which can't be observed without loading. A library found in site-packages or conda needs no subprocess. A test checks that for every supported library, locate_nvidia_dynamic_lib returns the same file as load_nvidia_dynamic_lib run in a child process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cuda.pathfinderEverything related to the cuda.pathfinder modulefeatureNew feature or request

Type

No type

Projects

  • Status
    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions