def _osx_gpudata():
 gpus = []
 try:
  pcictl_out = __salt__['cmd.run']('system_profiler SPDisplaysDataType')
  for line in pcictl_out.splitlines():
   (fieldname, _, fieldval) = line.partition(': ')
   if (fieldname.strip() == 'Chipset Model'):
    (vendor, _, model) = fieldval.partition(' ')
    vendor = vendor.lower()
    gpus.append({'vendor': vendor, 'model': model})
 except OSError:
  pass
 grains = {}
 grains['num_gpus'] = len(gpus)
 grains['gpus'] = gpus
 return grains

def _osx_gpudata ( ) : gpus = [ ] try : pcictl_out = __salt__ [ 'cmd.run' ] ( 'system_profiler SPDisplaysDataType' ) for line in pcictl_out . splitlines ( ) : ( fieldname , _ , fieldval ) = line . partition ( ': ' ) if ( fieldname . strip ( ) == 'Chipset Model' ) : ( vendor , _ , model ) = fieldval . partition ( ' ' ) vendor = vendor . lower ( ) gpus . append ( { 'vendor' : vendor , 'model' : model } ) except OSError : pass grains = { } grains [ 'num_gpus' ] = len ( gpus ) grains [ 'gpus' ] = gpus return grains
num_gpus: int gpus: - vendor: nvidia|amd|ati| .