Ejemplo n.º 1
0
def _nccl_available():
    if not HOROVOD_AVAILABLE:
        return False
    try:
        return nccl_built()
    except AttributeError:
        return False
Ejemplo n.º 2
0
    def __call__(self, parser, args, values, option_string=None):
        output = '''\
        Horovod v{version}:

        Available Frameworks:
          [{tensorflow}] TensorFlow
          [{torch}] PyTorch
          [{mxnet}] MXNet

        Available Controllers:
          [{mpi}] MPI
          [{gloo}] Gloo

        Available Tensor Operations:
          [{nccl_ops}] NCCL
          [{ddl_ops}] DDL
          [{mlsl_ops}] MLSL
          [{mpi_ops}] MPI
          [{gloo_ops}] Gloo\
        '''.format(
            version=horovod.__version__,
            tensorflow=CheckBuildAction.get_check(
                extension_available('tensorflow')),
            torch=CheckBuildAction.get_check(extension_available('torch')),
            mxnet=CheckBuildAction.get_check(extension_available('mxnet')),
            mpi=CheckBuildAction.get_check(mpi_built()),
            gloo=CheckBuildAction.get_check(gloo_built()),
            nccl_ops=CheckBuildAction.get_check(nccl_built()),
            ddl_ops=CheckBuildAction.get_check(ddl_built()),
            mpi_ops=CheckBuildAction.get_check(mpi_built()),
            mlsl_ops=CheckBuildAction.get_check(mlsl_built()),
            gloo_ops=CheckBuildAction.get_check(gloo_built()))
        print(textwrap.dedent(output))
        os._exit(0)
def _nccl_available():
    if not HOROVOD_AVAILABLE:
        return False

    try:
        return nccl_built()
    except AttributeError:
        # Horovod 0.19.1 nccl_built() does not yet work with Python 3.8:
        # See: https://github.com/horovod/horovod/issues/1891
        return False
Ejemplo n.º 4
0
def check_build(verbose):
    def get_check(value):
        return 'X' if value else ' '

    output = '''{verbose_newline}\
    Horovod v{version}:

    Available Frameworks:
        [{tensorflow}] TensorFlow
        [{torch}] PyTorch
        [{mxnet}] MXNet

    Available Controllers:
        [{mpi}] MPI
        [{gloo}] Gloo

    Available Tensor Operations:
        [{nccl_ops}] NCCL
        [{ddl_ops}] DDL
        [{ccl_ops}] CCL
        [{mpi_ops}] MPI
        [{gloo_ops}] Gloo\
    '''.format(verbose_newline='\n' if verbose else '',
               version=horovod.__version__,
               tensorflow=get_check(
                   extension_available('tensorflow', verbose=verbose)),
               torch=get_check(extension_available('torch', verbose=verbose)),
               mxnet=get_check(extension_available('mxnet', verbose=verbose)),
               mpi=get_check(mpi_built(verbose=verbose)),
               gloo=get_check(gloo_built(verbose=verbose)),
               nccl_ops=get_check(nccl_built(verbose=verbose)),
               ddl_ops=get_check(ddl_built(verbose=verbose)),
               mpi_ops=get_check(mpi_built(verbose=verbose)),
               ccl_ops=get_check(ccl_built(verbose=verbose)),
               gloo_ops=get_check(gloo_built(verbose=verbose)))
    print(textwrap.dedent(output))
    os._exit(0)
Ejemplo n.º 5
0
from pytorch_lightning.utilities import (
    _APEX_AVAILABLE,
    _DEEPSPEED_AVAILABLE,
    _FAIRSCALE_AVAILABLE,
    _FAIRSCALE_PIPE_AVAILABLE,
    _HOROVOD_AVAILABLE,
    _NATIVE_AMP_AVAILABLE,
    _RPC_AVAILABLE,
    _TORCH_QUANTIZE_AVAILABLE,
    _TPU_AVAILABLE,
)

try:
    from horovod.common.util import nccl_built
    nccl_built()
except (ImportError, ModuleNotFoundError, AttributeError):
    _HOROVOD_NCCL_AVAILABLE = False
finally:
    _HOROVOD_NCCL_AVAILABLE = True


class RunIf:
    """
    RunIf wrapper for simple marking specific cases, fully compatible with pytest.mark::

        @RunIf(min_torch="0.0")
        @pytest.mark.parametrize("arg1", [1, 2.0])
        def test_wrapper(arg1):
            assert arg1 > 0.0
    """