()
Get and save CUBLAS version using the CUBLAS library's SONAME.

    This function tries to avoid calling cublasGetVersion because creating a 
    CUBLAS context can subtly affect the performance of subsequent 
    CUDA operations in certain circumstances. 

    Results
    -------
    version : str
        Zeros are appended to match format of version returned
        by cublasGetVersion() (e.g., '6050' corresponds to version 6.5).

    Notes
    -----
    Since the version number does not appear to be obtainable from the
    MacOSX CUBLAS library, this function must call cublasGetVersion() on
    MacOSX (but raises a warning to let the user know).
Get and save CUBLAS version using the CUBLAS library's SONAME.
Get and save CUBLAS version using the CUBLAS library s SONAME .
def _get_cublas_version():
    """
    Get and save CUBLAS version using the CUBLAS library's SONAME.

    This function tries to avoid calling cublasGetVersion because creating a 
    CUBLAS context can subtly affect the performance of subsequent 
    CUDA operations in certain circumstances. 

    Results
    -------
    version : str
        Zeros are appended to match format of version returned
        by cublasGetVersion() (e.g., '6050' corresponds to version 6.5).

    Notes
    -----
    Since the version number does not appear to be obtainable from the
    MacOSX CUBLAS library, this function must call cublasGetVersion() on
    MacOSX (but raises a warning to let the user know).
    """

    cublas_path = utils.find_lib_path('cublas')
    try:
        major, minor = re.search(r'[\D\.]+\.+(\d+)\.(\d+)',
                                 utils.get_soname(cublas_path)).groups()
    except:

        # Create a temporary context to run cublasGetVersion():
        warnings.warn('creating CUBLAS context to get version number')
        h = cublasCreate()
        version = cublasGetVersion(h)
        cublasDestroy(h)
        return str(version)
    else:
        return major.ljust(len(major)+1, '0')+minor.ljust(2, '0')
def _get_cublas_version ( ) : cublas_path = utils . find_lib_path ( 'cublas' ) try : major , minor = re . search ( r'[\D\.]+\.+(\d+)\.(\d+)' , utils . get_soname ( cublas_path ) ) . groups ( ) except : # Create a temporary context to run cublasGetVersion(): warnings . warn ( 'creating CUBLAS context to get version number' ) h = cublasCreate ( ) version = cublasGetVersion ( h ) cublasDestroy ( h ) return str ( version ) else : return major . ljust ( len ( major ) + 1 , '0' ) + minor . ljust ( 2 , '0' )