def gpus():
    """Yields GPU nodes within KFD topology and their properties"""
    for np in sorted(glob.glob('/sys/devices/virtual/kfd/kfd/topology/nodes/*')):
        props = parse_props(np + '/properties')

        # Skip CPUs
        if props['gfx_target_version'] == 0:
            continue

        yield np, props
Yields GPU nodes within KFD topology and their properties
ramalama/amdkfd.py