Skip to content

[FEA]: Support LoadedDL.from_distribution #759

Closed

Description

@brandon-b-miller

Is this a duplicate?

Area

cuda.bindings

Is your feature request related to a problem? Please describe.

Numba would like to report to the user not only the path it found it's dependencies on, but also the distribution that they came from. For instance consider the output of numba -s:

CUDA Libraries Test Output:                                                                                                                                                                                                                               
Finding driver from candidates:                                                                                                                                                                                                                           
        libcuda.so                                                                                                                                                                                                                                        
        libcuda.so.1                                                                                                                                                                                                                                      
        /usr/lib/libcuda.so                                                                                                                                                                                                                               
        /usr/lib/libcuda.so.1                                                                                                                                                                                                                             
        /usr/lib64/libcuda.so                                                                                                                                                                                                                             
        /usr/lib64/libcuda.so.1                                                                                                                                                                                                                           
Using loader <class 'ctypes.CDLL'>                                                                                                                                                                                                                        
        Trying to load driver...        ok                                                                                                                                                                                                                
                Loaded from libcuda.so                                                                                                                                                                                                                    
        Mapped libcuda.so paths:                                                                                                                                                                                                                          
                /usr/lib/x86_64-linux-gnu/libcuda.so.535.161.08                                                                                                                                                                                           
Finding nvvm from Conda environment (NVIDIA package)                                                                                                                                                                                                      
        Located at /mambaforge/envs/myenv/nvvm/lib64/libnvvm.so.4.0.0                                                                                                                                                                    
        Trying to open library...       ok                                                                                                                                                                                                                
Finding nvrtc from Conda environment (NVIDIA package)                                                                                                                                                                                                     
        Located at /mambaforge/envs/myenv/lib/libnvrtc.so.12.9.86                                                                                                                                                                        
        Trying to open library...       ok                                                                                                                                                                                                                
Finding cudart from Conda environment (NVIDIA package)                                                                                                                                                                                                    
        Located at /mambaforge/envs/myenv/lib/libcudart.so.12.9.79                                                                                                                                                                       
        Trying to open library...       ok                                                                                                                                                                                                                
Finding cudadevrt from Conda environment (NVIDIA package)                                                                                                                                                                                                 
        Located at /mambaforge/envs/myenv/lib/libcudadevrt.a                                                                                                                                                                             
        Checking library...     ok                                                                                                                                                                                                                        
Finding libdevice from Conda environment (NVIDIA package)                                                                                                                                                                                                 
        Located at /mambaforge/envs/myenv/nvvm/libdevice/libdevice.10.bc                                                                                                                                                                 
        Checking library...     ok                                                                                                                                                                                                                        
Include directory configuration variable:                                                                                                                                                                                                                 
        CUDA_INCLUDE_PATH=/usr/local/cuda/include                                                                                                                                                                                                         
Finding include directory from Conda environment (NVIDIA package)                                                                                                                                                                                         
        Located at /mambaforge/envs/myenv/targets/x86_64-linux/include                                                                                                                                                                   
        Checking include directory...   ok  

Describe the solution you'd like

It would be useful if the LoadedDL class supported a from_distribution property that reported the source, such as wheel, conda or system ctk.

Describe alternatives you've considered

Without this, using pathfinder would require decoding the source distribution from the path supplied by pathfinder if we want to maintain the information currently supplied by the output.

Additional context

No response

Activity

  1. added
    featureNew feature or request
    cuda.pathfinderEverything related to the cuda.pathfinder module
    on Jul 15, 2025
  2. self-assigned this
    on Jul 18, 2025
  3. brandon-b-miller commented on Sep 24, 2025

    @brandon-b-miller
    ContributorAuthor

    Discussed some high level ideas around this with @rwgk who suggested returning a small dataclass that contains the source of the library as well as the ctk version. Given that we have full flexibility to choose the API for this I'd support including as much information as possible to start out with, so maybe let's begin with the goal of LoadedDl.from_distribution returning a Distribution class with a distribution and a cuda_version attribute.

    distribution could be a string that reports one of {'site-packages', 'Conda', 'system', 'CUDA_HOME'}, also as suggested by @rwgk, and cuda_version could be string or major/minor version tuple.

    As a starting point I'd suggest expanding the ctor of LoadedDL to expect either a Distribution object or one or both of the attrs needed to construct one, then, perhaps we can populate the info wherever we instantiate the class we intend to return.

  4. rwgk commented on Sep 24, 2025

    @rwgk
    Contributor

    Sounds great! At the danger of slipping into bike shedding:

    Alternatives to distribution: pkg_kind, pkg_system (to have something less generic, not as prone to ambiguity / misunderstanding)

    cuda_version could be string or major/minor version tuple.

    A namedtuple in the style of sys.version_info would seem great.

  5. moved this from Todo to Done in CCCLon Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

cuda.pathfinderEverything related to the cuda.pathfinder modulefeatureNew feature or requesttriageNeeds the team's attention

Type

No type

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions