INNER CODE UNIT · Python
check_extension
bytedance/byteps · byteps/common/__init__.py:44
def check_extension(ext_name, ext_env_var, pkg_path, *args):
full_path = get_extension_full_path(pkg_path, *args)
if not os.path.exists(full_path):
raise ImportError(
'Extension %s has not been built. If this is not expected, reinstall '
'BytePS with %s=1 to debug the build error.' % (ext_name, ext_env_var))
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)