Пример #1
0
def get_nccllib(lib, platform=None, path=None):
    if not path:
        libdir = os.environ.get('NUMBA_NCCLLIB')
    else:
        libdir = path
    candidates = find_lib(lib, libdir, platform)
    return max(candidates) if candidates else None
Пример #2
0
 def test_detect(self):
     """
     This test is solely present to ensure that shipped cudatoolkits have
     additional core libraries in locations that Numba scans by default.
     PyCulib (and potentially others) rely on Numba's library finding
     capacity to find and subsequently load these libraries.
     """
     core_libs = ['nvvm', 'cublas', 'cusparse', 'cufft', 'curand']
     for l in core_libs:
         self.assertNotEqual(find_lib(l), [])
Пример #3
0
def get_conda_ctk():
    """Return path to directory containing the shared libraries of cudatoolkit."""
    is_conda_env = os.path.exists(os.path.join(sys.prefix, "conda-meta"))
    if not is_conda_env:
        return
    # Asssume the existence of NVVM to imply cudatoolkit installed
    paths = find_lib("nvvm")
    if not paths:
        return
    # Use the directory name of the max path
    return os.path.dirname(max(paths))
Пример #4
0
def get_cudalib(lib, platform=None):
    """
    Find the path of a CUDA library based on a search of known locations. If
    the search fails, return a generic filename for the library (e.g.
    'libnvvm.so' for 'nvvm') so that we may attempt to load it using the system
    loader's search mechanism.
    """
    if lib == 'nvvm':
        return get_cuda_paths()['nvvm'].info or _dllnamepattern % 'nvvm'
    else:
        libdir = get_cuda_paths()['cudalib_dir'].info

    candidates = find_lib(lib, libdir, platform)
    return max(candidates) if candidates else _dllnamepattern % lib
Пример #5
0
def _get_nvvm_path():
    by, path = _get_nvvm_path_decision()
    candidates = find_lib('nvvm', path)
    path = max(candidates) if candidates else None
    return _env_path_tuple(by, path)