def get_available_engine(
    cpu: bool = False,
    fp16: bool = False,
    ddp: bool = False,
) -> "Engine":
    """Returns available engine based on given arguments.

    Args:
        cpu (bool): option to use cpu for training. Default is `False`.
        ddp (bool): option to use DDP for training. Default is `False`.
        fp16 (bool): option to use APEX for training. Default is `False`.

    Returns:
        Engine which match requirements.
    """
    from catalyst.engines.torch import (
        CPUEngine,
        DataParallelEngine,
        DistributedDataParallelEngine,
        GPUEngine,
    )

    if SETTINGS.xla_required:
        from catalyst.engines.torch import DistributedXLAEngine

        return DistributedXLAEngine()

    if cpu or not torch.cuda.is_available():
        return CPUEngine()
    is_multiple_gpus = torch.cuda.device_count() > 1
    if is_multiple_gpus:
        if ddp:
            return DistributedDataParallelEngine(fp16=fp16)
        else:
            return DataParallelEngine(fp16=fp16)
    else:
        return GPUEngine(fp16=fp16)
Returns available engine based on given arguments.

    Args:
        cpu (bool): option to use cpu for training. Default is `False`.
        ddp (bool): option to use DDP for training. Default is `False`.
        fp16 (bool): option to use APEX for training. Default is `False`.

    Returns:
        Engine which match requirements.
    
catalyst/utils/torch.py