def CudaScope(gpu_id):
    """Create a CUDA device scope for GPU device `gpu_id`."""
    gpu_dev = CudaDevice(gpu_id)
    with core.DeviceScope(gpu_dev):
        yield
Create a CUDA device scope for GPU device `gpu_id`.
detectron/utils/c2.py