def get_gpu_workers(workers_resources, max_gpu_per_worker=1):
    """
    Get the workers that can use a GPU.

    Parameters
    ----------
    workers_resources: dict
        Dictionary of workers resources obtained with `get_workers_resources`
    max_gpu_per_worker: int, optional
        Maximum GPUs allower per worker. If a worker can "see" more than
        `max_gpu_per_worker`, it will raise an error.
    Returns
    -------
    gpu_workers: dict
        Dictionary of workers that can use a GPU, along with the usable GPUs.
    nongpu_workers: list
        List of workers that cannot use a GPU
    """
    gpu_workers = {}
    nongpu_workers = []
    for worker_name, resources in workers_resources.items():
        w_gpus = {'cuda_gpus': {}, 'opencl_gpus': {}}
        for gpu_type in ['cuda_gpus', 'opencl_gpus']:
            if gpu_type not in resources:
                continue
            gpus = resources[gpu_type] or {}
            if len(gpus) > max_gpu_per_worker:
                raise ValueError('Expected at most %d GPUs, got %d' % (
                    max_gpu_per_worker, len(gpus)))
            if len(gpus) == 0:
                continue
            w_gpus[gpu_type] = gpus
        if len(w_gpus['opencl_gpus']) == 0 and len(w_gpus['cuda_gpus']) == 0:
            nongpu_workers.append(worker_name)
        else:
            gpu_workers[worker_name] = w_gpus
    return gpu_workers, nongpu_workers
