()
return cudaconfig
Locate the CUDA environment on the system
    Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
    and values giving the absolute path to each directory.
    Starts by looking for the CUDAHOME env variable. If not found, everything
    is based on finding 'nvcc' in the PATH.
Locate the CUDA environment on the system
    Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
    and values giving the absolute path to each directory.
    Starts by looking for the CUDAHOME env variable. If not found, everything
    is based on finding 'nvcc' in the PATH.
Locate the CUDA environment on the system Returns a dict with keys home nvcc include and lib64 and values giving the absolute path to each directory . Starts by looking for the CUDAHOME env variable . If not found everything is based on finding nvcc in the PATH .
def locate_cuda():
    """Locate the CUDA environment on the system
    Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
    and values giving the absolute path to each directory.
    Starts by looking for the CUDAHOME env variable. If not found, everything
    is based on finding 'nvcc' in the PATH.
    """

    # first check if the CUDAHOME env variable is in use
    if 'CUDAHOME' in os.environ:
        home = os.environ['CUDAHOME']
        nvcc = pjoin(home, 'bin', 'nvcc')
    else:
        # otherwise, search the PATH for NVCC
        default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
        nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
        if nvcc is None:
            raise EnvironmentError('The nvcc binary could not be '
                'located in your $PATH. Either add it to your path, or set $CUDAHOME')
        home = os.path.dirname(os.path.dirname(nvcc))

    cudaconfig = {'home':home, 'nvcc':nvcc,
                  'include': pjoin(home, 'include'),
                  'lib64': pjoin(home, 'lib64')}
    for k, v in cudaconfig.items():
        if not os.path.exists(v):
            raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))

    return cudaconfig
def locate_cuda ( ) : # first check if the CUDAHOME env variable is in use if 'CUDAHOME' in os . environ : home = os . environ [ 'CUDAHOME' ] nvcc = pjoin ( home , 'bin' , 'nvcc' ) else : # otherwise, search the PATH for NVCC default_path = pjoin ( os . sep , 'usr' , 'local' , 'cuda' , 'bin' ) nvcc = find_in_path ( 'nvcc' , os . environ [ 'PATH' ] + os . pathsep + default_path ) if nvcc is None : raise EnvironmentError ( 'The nvcc binary could not be ' 'located in your $PATH. Either add it to your path, or set $CUDAHOME' ) home = os . path . dirname ( os . path . dirname ( nvcc ) ) cudaconfig = { 'home' : home , 'nvcc' : nvcc , 'include' : pjoin ( home , 'include' ) , 'lib64' : pjoin ( home , 'lib64' ) } for k , v in cudaconfig . items ( ) : if not os . path . exists ( v ) : raise EnvironmentError ( 'The CUDA %s path could not be located in %s' % ( k , v ) ) return cudaconfig