Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version #343

Merged
merged 10 commits into from
Jul 28, 2023
Merged
11 changes: 7 additions & 4 deletions spinnman/processes/get_machine_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
get_config_bool, get_config_int, get_config_str)
from spinn_utilities.data import UtilsDataView
from spinn_utilities.log import FormatAdapter
from spinn_machine import (Router, Chip, Link, machine_from_size)
from spinn_machine import (Router, Chip, Link)
from spinn_machine.ignores import IgnoreChip, IgnoreCore, IgnoreLink
from spinn_machine import Machine
from spinn_machine.machine_factory import machine_repair
from spinnman.constants import (
ROUTER_REGISTER_P2P_ADDRESS, SYSTEM_VARIABLE_BASE_ADDRESS)
from spinnman.data import SpiNNManDataView
from spinnman.messages.spinnaker_boot import (
SystemVariableDefinition)
from spinnman.exceptions import SpinnmanUnexpectedResponseCodeException
Expand Down Expand Up @@ -94,7 +94,9 @@ def _make_chip(self, chip_info, machine):
:rtype: ~spinn_machine.Chip
"""
# Create the down cores set if any
n_cores = min(chip_info.n_cores, Machine.max_cores_per_chip())
n_cores = \
SpiNNManDataView.get_machine_version().max_cores_per_chip
n_cores = min(chip_info.n_cores, n_cores)
core_states = chip_info.core_states
down_cores = self._ignore_cores_map.get(
(chip_info.x, chip_info.y), None)
Expand Down Expand Up @@ -233,7 +235,8 @@ def get_machine_details(self, boot_x, boot_y, width, height):
logger.warning(
"Chip {}, {} was expected but didn't reply", x, y)

machine = machine_from_size(width, height)
version = SpiNNManDataView.get_machine_version()
machine = version.create_machine(width, height)
self._preprocess_ignore_chips(machine)
self._process_ignore_links(machine)
self._preprocess_ignore_cores(machine)
Expand Down
9 changes: 3 additions & 6 deletions spinnman/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from spinn_utilities.log import FormatAdapter
from spinn_utilities.logger_utils import warn_once
from spinn_machine import CoreSubsets
from spinn_machine.spinnaker_triad_geometry import SpiNNakerTriadGeometry
from spinnman.constants import (
BMP_POST_POWER_ON_SLEEP_TIME, BMP_POWER_ON_TIMEOUT, BMP_TIMEOUT,
CPU_MAX_USER, CPU_USER_OFFSET, CPU_USER_START_ADDRESS,
Expand Down Expand Up @@ -532,8 +531,8 @@ def discover_scamp_connections(self):
dims = self.get_machine_dimensions()

# Find all the new connections via the machine Ethernet-connected chips
geometry = SpiNNakerTriadGeometry.get_spinn5_geometry()
for x, y in geometry.get_potential_ethernet_chips(
version = SpiNNManDataView.get_machine_version()
for x, y in version.get_potential_ethernet_chips(
dims.width, dims.height):
ip_addr_item = SystemVariableDefinition.ethernet_ip_address
try:
Expand Down Expand Up @@ -644,9 +643,7 @@ def get_machine_details(self):
machine.add_fpga_links()

if self._boot_send_connection:
logger.info("Detected a machine on IP address {} which has {}",
machine.boot_chip.ip_address,
machine.cores_and_link_output_string())
logger.info(f"Detected {machine.summary_string()}")
return machine

def is_connected(self, connection=None):
Expand Down
2 changes: 2 additions & 0 deletions unittests/data/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import unittest
from spinn_utilities.config_holder import set_config
from spinn_utilities.exceptions import (DataNotYetAvialable)
from spinnman.config_setup import unittest_setup
from spinnman.data import SpiNNManDataView
Expand Down Expand Up @@ -42,6 +43,7 @@ def test_setup(self):

def test_mock(self):
SpiNNManDataWriter.mock()
set_config("Machine", "version", 5)
# check there is a
# value not what it is
SpiNNManDataView.get_machine()
Expand Down
2 changes: 2 additions & 0 deletions unittests/model_tests/test_abstract_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from spinn_utilities.config_holder import set_config
from spinnman.processes.abstract_multi_connection_process import (
AbstractMultiConnectionProcess)
from spinnman.messages.scp.impl import ReadMemory
Expand Down Expand Up @@ -42,6 +43,7 @@ def receive_scp_response(self, timeout=1.0):

def test_error_print():
unittest_setup()
set_config("Machine", "version", 5)
connection = MockConnection(0, 0)
process = MockProcess(RoundRobinConnectionSelector([connection]))
with pytest.raises(SpinnmanGenericProcessException):
Expand Down
4 changes: 3 additions & 1 deletion unittests/test_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import unittest
import struct
from spinn_utilities.config_holder import set_config
from spinn_machine import virtual_machine
from spinnman.config_setup import unittest_setup
from spinnman.data.spinnman_data_writer import SpiNNManDataWriter
Expand All @@ -38,7 +39,7 @@ def __init__(
self.written_memory = list()

def get_machine_details(self):
return virtual_machine(2, 2)
return virtual_machine(8, 8)

def _update_machine(self):
self._machine = self.get_machine_details()
Expand All @@ -58,6 +59,7 @@ class TestTransceiver(unittest.TestCase):

def setUp(self):
unittest_setup()
set_config("Machine", "version", 5)

def test_create_new_transceiver_to_board(self):
board_config.set_up_remote_board()
Expand Down