coordinator#

Module Contents#

Coordinator

Deal with the mapping relation between client id and process rank in FL system.

class Coordinator(setup_dict, mode='LOCAL')#

Bases: object

Deal with the mapping relation between client id and process rank in FL system.

Note

Server Manager creates a Coordinator following: 1. init network connection. 2. client send local group info (the number of client simulating in local) to server. 4. server receive all info and init a server Coordinator.

Parameters
  • setup_dict (dict) – A dict like {rank:client_num …}, representing the map relation between process rank and client id.

  • mode (str, optional) – “GLOBAL” and “LOCAL”. Coordinator will map client id to (rank, global id) or (rank, local id) according to mode. For example, client id 51 is in a machine which has 1 manager and serial trainer simulating 10 clients. LOCAL id means the index of its 10 clients. Therefore, global id 51 will be mapped into local id 1 (depending on setting).

map_id(self, id)#

a map function from client id to (rank,local id)

Parameters

id (int) – client id

Returns

rank in distributed group and local id.

Return type

rank, id

map_id_list(self, id_list)#

a map function from id_list to dict{rank:local id}

This can be very useful in Scale modules.

Parameters

id_list (list(int)) – a list of client id.

Returns

contains process rank and its relative local client ids.

Return type

map_dict (dict)

switch(self)#
property total(self)#
__str__(self) str#

Return str(self).

__call__(self, info, *args, **kwds)#