(device_id=None, verbose=False)
return max(full_version)
Query compute capability through PyCuda and check it's 5.0 (Maxwell) or
    greater.
    5.0 (GTX750 Ti) only fp32 support
    5.2 (GTX9xx series) required for fp16
    By default, check all devices and return the highest compute capability.

    Arguments:
        device_id (int): CUDA device id. Default to None, will iterate over
                         all devices if None.
        verbose (bool): prints verbose logging if True, default False.

    Returns:
        float: Zero if no GPU is found, otherwise highest compute capability.
Query compute capability through PyCuda and check it's 5.0 (Maxwell) or
    greater.
    5.0 (GTX750 Ti) only fp32 support
    5.2 (GTX9xx series) required for fp16
    By default, check all devices and return the highest compute capability.
Query compute capability through PyCuda and check it s 5 . 0 ( Maxwell ) or greater . 5 . 0 ( GTX750 Ti ) only fp32 support 5 . 2 ( GTX9xx series ) required for fp16 By default check all devices and return the highest compute capability .
def get_compute_capability(device_id=None, verbose=False):
    """
    Query compute capability through PyCuda and check it's 5.0 (Maxwell) or
    greater.
    5.0 (GTX750 Ti) only fp32 support
    5.2 (GTX9xx series) required for fp16
    By default, check all devices and return the highest compute capability.

    Arguments:
        device_id (int): CUDA device id. Default to None, will iterate over
                         all devices if None.
        verbose (bool): prints verbose logging if True, default False.

    Returns:
        float: Zero if no GPU is found, otherwise highest compute capability.
    """
    try:
        import pycuda
        import pycuda.driver as drv
    except ImportError:
        if verbose:
            neon_logger.display("PyCUDA module not found")
        return 0
    try:
        drv.init()
    except pycuda._driver.RuntimeError as e:
        neon_logger.display("PyCUDA Runtime error: {0}".format(str(e)))
        return 0

    major_string = pycuda._driver.device_attribute.COMPUTE_CAPABILITY_MAJOR
    minor_string = pycuda._driver.device_attribute.COMPUTE_CAPABILITY_MINOR
    full_version = []
    if device_id is None:
        device_id = list(range(drv.Device.count()))
    elif isinstance(device_id, int):
        device_id = [device_id]

    for i in device_id:
        major = drv.Device(i).get_attribute(major_string)
        minor = drv.Device(i).get_attribute(minor_string)
        full_version += [major + minor / 10.]

    if verbose:
        neon_logger.display("Found GPU(s) with compute capability: {}".format(full_version))

    return max(full_version)
def get_compute_capability ( device_id = None , verbose = False ) : try : import pycuda import pycuda . driver as drv except ImportError : if verbose : neon_logger . display ( "PyCUDA module not found" ) return 0 try : drv . init ( ) except pycuda . _driver . RuntimeError as e : neon_logger . display ( "PyCUDA Runtime error: {0}" . format ( str ( e ) ) ) return 0 major_string = pycuda . _driver . device_attribute . COMPUTE_CAPABILITY_MAJOR minor_string = pycuda . _driver . device_attribute . COMPUTE_CAPABILITY_MINOR full_version = [ ] if device_id is None : device_id = list ( range ( drv . Device . count ( ) ) ) elif isinstance ( device_id , int ) : device_id = [ device_id ] for i in device_id : major = drv . Device ( i ) . get_attribute ( major_string ) minor = drv . Device ( i ) . get_attribute ( minor_string ) full_version += [ major + minor / 10. ] if verbose : neon_logger . display ( "Found GPU(s) with compute capability: {}" . format ( full_version ) ) return max ( full_version )