"""Loads a .so file containing the specified operators. Args: name: The name of the .so file to load. Raises: NotFoundError if were not able to load .so file. """ filename = resource_loader.get_path_to_datafile(name) library = load_library.load_op_library(filename) return library MPI_LIB = _load_library('mpi_lib' + get_ext_suffix()) _basics = _HorovodBasics(__file__, 'mpi_lib') # import basic methods init = _basics.init shutdown = _basics.shutdown is_initialized = _basics.is_initialized start_timeline = _basics.start_timeline stop_timeline = _basics.stop_timeline size = _basics.size local_size = _basics.local_size rank = _basics.rank local_rank = _basics.local_rank mpi_threads_supported = _basics.mpi_threads_supported mpi_enabled = _basics.mpi_enabled mpi_built = _basics.mpi_built gloo_enabled = _basics.gloo_enabled
from __future__ import print_function from distutils.version import LooseVersion # Load all the necessary PyTorch C types. import torch import warnings # PyTorch v2 API starts with 1.0.0 (including nightly builds) _v2_api = LooseVersion(torch.__version__) >= LooseVersion('1.0.0') if _v2_api: from horovod.torch import mpi_lib_v2 as mpi_lib from horovod.common.basics import HorovodBasics as _HorovodBasics _NULL = "" _basics = _HorovodBasics(__file__, 'mpi_lib_v2') else: from horovod.torch import mpi_lib_impl from horovod.torch import mpi_lib from horovod.common.basics import HorovodBasics as _HorovodBasics _NULL = mpi_lib._ffi.NULL _basics = _HorovodBasics(__file__, 'mpi_lib_impl', '_mpi_lib_impl') from horovod.common.util import get_average_backwards_compatibility_fun, gpu_available, num_rank_is_power_2 from horovod.torch.compression import Compression # import basic methods init = _basics.init shutdown = _basics.shutdown size = _basics.size