Skip to content

Commit

Permalink
Merge pull request #181 from SpiNNakerManchester/project_eighteen
Browse files Browse the repository at this point in the history
Project eighteen
  • Loading branch information
dkfellows committed Oct 22, 2019
2 parents be378eb + 647a996 commit 8a29179
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
3 changes: 3 additions & 0 deletions spinnman/model/chip_summary_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,6 @@ def ethernet_ip_address(self):
:rtype: str
"""
return self._ethernet_ip_address

def __repr__(self):
return "x:{} y:{} n_cores:{}".format(self.x, self.y, self.n_cores)
21 changes: 3 additions & 18 deletions spinnman/processes/get_machine_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,17 @@ class GetMachineProcess(AbstractMultiConnectionProcess):
"_ignore_chips",
"_ignore_cores",
"_ignore_links",
"_max_core_id",
"_max_sdram_size",
"_p2p_column_data"]

def __init__(self, connection_selector, ignore_chips, ignore_cores,
ignore_links, max_core_id, max_sdram_size=None):
ignore_links, max_sdram_size=None):
# pylint: disable=too-many-arguments
super(GetMachineProcess, self).__init__(connection_selector)

self._ignore_chips = ignore_chips if ignore_chips is not None else {}
self._ignore_cores = ignore_cores if ignore_cores is not None else {}
self._ignore_links = ignore_links if ignore_links is not None else {}
if max_core_id is None:
self._max_core_id = Machine.MAX_CORES_PER_CHIP
elif max_core_id == Machine.MAX_CORES_PER_CHIP:
self._max_core_id = Machine.MAX_CORES_PER_CHIP
elif max_core_id > Machine.MAX_CORES_PER_CHIP:
logger.warning(
"Max core id reduced to {} based on "
"Machine.MAX_CORES_PER_CHIP".format(
Machine.MAX_CORES_PER_CHIP))
self._max_core_id = Machine.MAX_CORES_PER_CHIP
else:
self._max_core_id = max_core_id

self._max_sdram_size = max_sdram_size

Expand All @@ -83,11 +70,9 @@ def _make_chip(self, chip_info, machine):

# Create the processor list
processors = list()
max_core_id = chip_info.n_cores - 1
n_cores = min(chip_info.n_cores, Machine.MAX_CORES_PER_CHIP)
core_states = chip_info.core_states
if max_core_id > self._max_core_id:
max_core_id = self._max_core_id
for virtual_core_id in range(max_core_id + 1):
for virtual_core_id in range(n_cores):
# Add the core provided it is not to be ignored
if ((chip_info.x, chip_info.y, virtual_core_id) not in
self._ignore_cores):
Expand Down
18 changes: 4 additions & 14 deletions spinnman/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
def create_transceiver_from_hostname(
hostname, version, bmp_connection_data=None, number_of_boards=None,
ignore_chips=None, ignore_cores=None, ignored_links=None,
max_core_id=None, auto_detect_bmp=False, scamp_connections=None,
auto_detect_bmp=False, scamp_connections=None,
boot_port_no=None, max_sdram_size=None, repair_machine=False,
ignore_bad_ethernets=True):
""" Create a Transceiver by creating a UDPConnection to the given\
Expand All @@ -122,9 +122,6 @@ def create_transceiver_from_hostname(
Requests for a "machine" will have these links excluded, as if they \
never existed.
:type ignored_links: set of (int, int, int)
:param max_core_id: The maximum core ID in any discovered machine.\
Requests for a "machine" will only have core IDs up to this value.
:type max_core_id: int
:param version: the type of SpiNNaker board used within the SpiNNaker\
machine being used. If a spinn-5 board, then the version will be 5,\
spinn-3 would equal 3 and so on.
Expand Down Expand Up @@ -200,7 +197,7 @@ def create_transceiver_from_hostname(

return Transceiver(
version, connections=connections, ignore_chips=ignore_chips,
ignore_cores=ignore_cores, max_core_id=max_core_id,
ignore_cores=ignore_cores,
ignore_links=ignored_links, scamp_connections=scamp_connections,
max_sdram_size=max_sdram_size, repair_machine=repair_machine,
ignore_bad_ethernets=ignore_bad_ethernets)
Expand Down Expand Up @@ -235,7 +232,6 @@ class Transceiver(object):
"_iobuf_size",
"_machine",
"_machine_off",
"_max_core_id",
"_max_sdram_size",
"_multicast_sender_connections",
"_n_chip_execute_locks",
Expand All @@ -255,7 +251,7 @@ class Transceiver(object):

def __init__(
self, version, connections=None, ignore_chips=None,
ignore_cores=None, ignore_links=None, max_core_id=None,
ignore_cores=None, ignore_links=None,
scamp_connections=None, max_sdram_size=None, repair_machine=False,
ignore_bad_ethernets=True):
"""
Expand All @@ -279,10 +275,6 @@ def __init__(
machine. Requests for a "machine" will have these links excluded,\
as if they never existed.
:type ignore_links: set of (int, int, int)
:param max_core_id: The maximum core ID in any discovered machine.\
Requests for a "machine" will only have core IDs up to and\
including this value.
:type max_core_id: int
:param max_sdram_size: the max size each chip can say it has for SDRAM\
(mainly used in debugging purposes)
:type max_sdram_size: int or None
Expand Down Expand Up @@ -324,7 +316,6 @@ def __init__(
self._ignore_chips = ignore_chips if ignore_chips is not None else {}
self._ignore_cores = ignore_cores if ignore_cores is not None else {}
self._ignore_links = ignore_links if ignore_links is not None else {}
self._max_core_id = max_core_id
self._max_sdram_size = max_sdram_size
self._iobuf_size = None
self._app_id_tracker = None
Expand Down Expand Up @@ -672,8 +663,7 @@ def _update_machine(self):
# Get the details of all the chips
get_machine_process = GetMachineProcess(
self._scamp_connection_selector, self._ignore_chips,
self._ignore_cores, self._ignore_links, self._max_core_id,
self._max_sdram_size)
self._ignore_cores, self._ignore_links, self._max_sdram_size)
self._machine = get_machine_process.get_machine_details(
version_info.x, version_info.y, self._width, self._height,
self._repair_machine, self._ignore_bad_ethernets)
Expand Down
5 changes: 2 additions & 3 deletions unittests/test_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ class MockWriteTransceiver(Transceiver):

def __init__(
self, version, connections=None, ignore_chips=None,
ignore_cores=None, ignore_links=None, max_core_id=None,
ignore_cores=None, ignore_links=None,
scamp_connections=None, max_sdram_size=None):
super(MockWriteTransceiver, self).__init__(
version, connections=connections, ignore_chips=ignore_chips,
ignore_cores=ignore_cores, ignore_links=ignore_links,
max_core_id=max_core_id, scamp_connections=scamp_connections,
max_sdram_size=max_sdram_size)
scamp_connections=scamp_connections, max_sdram_size=max_sdram_size)
self.written_memory = list()

def get_machine_details(self):
Expand Down

0 comments on commit 8a29179

Please sign in to comment.