def get_next_free_gpu_sequential(all_free_gpus, used_gpus, flagged_gpus):
    keys = sorted(all_free_gpus.keys())
    for key in keys:
        for gpu in all_free_gpus[key]:
            gpu_name = key + '_' + str(gpu)
            if gpu_name not in used_gpus and gpu_name not in flagged_gpus:
                return key, gpu
    return None, None
dataset/ETHPy150Open amaas/stanford-ctc/ctc_fast/cluster/utils.py/get_next_free_gpu_sequential/original