Skip to content

Commit

Permalink
Fix machine to cope with other spalloc machines
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Mar 27, 2018
1 parent 688ae37 commit 10919ed
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions spinn_machine/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,13 @@ def get_chips_on_board(self, chip):
max_coords = 8
for chip_x in range(0, max_coords):
for chip_y in range(0, max_coords):
if self.has_wrap_arounds:
if self.has_x_wrap_arounds:
x = (eth_x + chip_x) % (self._max_chip_x + 1)
y = (eth_y + chip_y) % (self._max_chip_y + 1)
else:
x = eth_x + chip_x
if self.has_y_wrap_arounds:
y = (eth_y + chip_y) % (self._max_chip_y + 1)
else:
y = eth_y + chip_y

if (self.is_chip_at(x, y) and
Expand Down Expand Up @@ -663,13 +665,29 @@ def total_cores(self):
return len([
processor for chip in self.chips for processor in chip.processors])

@property
def has_x_wrap_arounds(self):
""" If the machine has wrap around links in the x direction
:return: True if wrap around links exist, false otherwise
:rtype: bool
"""
return (self.max_chip_x + 1) == 2 or (self.max_chip_x + 1) % 12 == 0

@property
def has_y_wrap_arounds(self):
""" If the machine has wrap around links in the y direction
:return: True if wrap around links exist, false otherwise
:rtype: bool
"""
return (self.max_chip_y + 1) == 2 or (self.max_chip_y + 1) % 12 == 0

@property
def has_wrap_arounds(self):
""" If the machine has wrap around links
:return: True if wrap around links exist, false otherwise
:rtype: bool
"""
return ((self.max_chip_x + 1 == 2 and self.max_chip_y+1 == 2) or
((self.max_chip_x + 1) % 12 == 0 and
(self.max_chip_y + 1) % 12 == 0))
return self.has_x_wrap_arounds or self.has_y_wrap_arounds

0 comments on commit 10919ed

Please sign in to comment.