def get_device_count(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
 count = drv.Device.count()
 if verbose:
  neon_logger.display('Found {} GPU(s)'.format(count))
 return count

def get_device_count ( 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 count = drv . Device . count ( ) if verbose : neon_logger . display ( 'Found {} GPU(s)' . format ( count ) ) return count
query device count through pycuda .