Newer
Older
class Mapping:
"""
This class defines the bidirectional mapping between:
1. The unique identifier
2. machine_id and rank
Parameters
----------
n_procs : int
Total number of processes
def get_n_procs(self):
"""
Gives the global sum of all processes that are spawned on the machines
Returns
-------
int
the number of global processes
"""
return self.n_procs
def get_uid(self, rank: int, machine_id: int):
"""
Gives the global unique identifier of the node
Parameters
----------
rank : int
Node's rank on its machine
machine_id : int
node's machine in the cluster
"""
raise NotImplementedError
def get_machine_and_rank(self, uid: int):
"""
Gives the rank and machine_id of the node
Parameters
----------
uid : int
globally unique identifier of the node