def init(party_name=None, device=None): """ Initialize CrypTen. It will initialize communicator, setup party name for file save / load, and setup seeds for Random Number Generatiion. By default the function will initialize a set of RNG generators on CPU. If torch.cuda.is_available() returns True, it will initialize an additional set of RNG generators on GPU. Users can specify the GPU device the generators are initialized with device. Args: party_name (str): party_name for file save and load, default is None device (int, str, torch.device): Specify device for RNG generators on GPU. Must be a GPU device. """ # Return and raise warning if initialized if comm.is_initialized(): warnings.warn("CrypTen is already initialized.", RuntimeWarning) return # Initialize communicator comm._init(use_threads=False, init_ttp=crypten.mpc.ttp_required()) # Setup party name for file save / load if party_name is not None: comm.get().set_name(party_name) # Setup seeds for Random Number Generation if comm.get().get_rank() < comm.get().get_world_size(): _setup_przs(device=device) if crypten.mpc.ttp_required(): crypten.mpc.provider.ttp_provider.TTPClient._init()
def init(party_name=None): # Initialize communicator comm._init(use_threads=False, init_ttp=crypten.mpc.ttp_required()) # Setup party name for file save / load if party_name is not None: comm.get().set_name(party_name) # Setup seeds for Random Number Generation if comm.get().get_rank() < comm.get().get_world_size(): _setup_przs() if crypten.mpc.ttp_required(): crypten.mpc.provider.ttp_provider.TTPClient._init()
def init_thread(rank, world_size): comm._init(use_threads=True, rank=rank, world_size=world_size) _setup_przs()
def init(): comm._init(use_threads=False, init_ttp=crypten.mpc.ttp_required()) if comm.get().get_rank() < comm.get().get_world_size(): _setup_przs() if crypten.mpc.ttp_required(): crypten.mpc.provider.ttp_provider.TTPClient._init()
def init(): comm._init(use_threads=False) _setup_przs()