Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sacs/decentralizepy
  • mvujas/decentralizepy
  • randl/decentralizepy
3 results
Show changes
Showing
with 3888 additions and 234 deletions
...@@ -8,7 +8,7 @@ class Linear(Mapping): ...@@ -8,7 +8,7 @@ class Linear(Mapping):
""" """
def __init__(self, n_machines, procs_per_machine): def __init__(self, n_machines, procs_per_machine, global_service_machine=0):
""" """
Constructor Constructor
...@@ -23,6 +23,7 @@ class Linear(Mapping): ...@@ -23,6 +23,7 @@ class Linear(Mapping):
super().__init__(n_machines * procs_per_machine) super().__init__(n_machines * procs_per_machine)
self.n_machines = n_machines self.n_machines = n_machines
self.procs_per_machine = procs_per_machine self.procs_per_machine = procs_per_machine
self.global_service_machine = global_service_machine
def get_uid(self, rank: int, machine_id: int): def get_uid(self, rank: int, machine_id: int):
""" """
...@@ -41,6 +42,8 @@ class Linear(Mapping): ...@@ -41,6 +42,8 @@ class Linear(Mapping):
the unique identifier the unique identifier
""" """
if rank < 0:
return rank
return machine_id * self.procs_per_machine + rank return machine_id * self.procs_per_machine + rank
def get_machine_and_rank(self, uid: int): def get_machine_and_rank(self, uid: int):
...@@ -58,6 +61,8 @@ class Linear(Mapping): ...@@ -58,6 +61,8 @@ class Linear(Mapping):
a tuple of rank and machine_id a tuple of rank and machine_id
""" """
if uid < 0:
return uid, self.global_service_machine
return (uid % self.procs_per_machine), (uid // self.procs_per_machine) return (uid % self.procs_per_machine), (uid // self.procs_per_machine)
def get_local_procs_count(self): def get_local_procs_count(self):
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.