INNER CODE UNIT · Python

BytePSBasics

bytedance/byteps · byteps/common/__init__.py:52

class BytePSBasics(object):
    """Wrapper class for the basic BytePS API."""

    def __init__(self, pkg_path, *args):
        full_path = get_extension_full_path(pkg_path, *args)
        self.C_LIB_CTYPES = ctypes.CDLL(full_path, mode=ctypes.RTLD_GLOBAL)

    def init(self, lazy=True):
        """A function that inits BytePS."""
        atexit.register(self.shutdown)
        if lazy:
            return self.C_LIB_CTYPES.byteps_lazy_init()
        else:
            return self.C_LIB_CTYPES.byteps_init()

    def shutdown(self):
        """A function that shuts BytePS down."""
        return self.C_LIB_CTYPES.byteps_shutdown()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…