MCPcopy Create free account
hub / github.com/apache/singa / __start_rank_pairing

Method __start_rank_pairing

examples/hfl/src/server.py:79–89  ·  view source on GitHub ↗

Start pair each client to a global rank

(self)

Source from the content-addressed store, hash-verified

77 print("Server started.")
78
79 def __start_rank_pairing(self) -> None:
80 """Start pair each client to a global rank"""
81 for _ in range(self.num_clients):
82 conn, addr = self.sock.accept()
83 # rank is the global device_id when initializing the client
84 rank = utils.receive_int(conn)
85 self.conns[rank] = conn
86 self.addrs[rank] = addr
87 print(f"[Server] Connected by {addr} [global_rank {rank}]")
88
89 assert None not in self.conns
90
91 def start(self) -> None:
92 """Start the server.

Callers 1

startMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected