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.0))]
 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.0 ) ) ] if verbose : neon_logger . display ( 'Found GPU(s) with compute capability: {}' . format ( full_version ) ) return max ( full_version )
query compute capability through pycuda and check its 5 .