Skip to content

Commit

Permalink
merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Apr 16, 2024
2 parents 30228ff + 272a7d8 commit 3806368
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 29 deletions.
8 changes: 4 additions & 4 deletions spinnman/messages/scp/impl/fixed_route_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import struct
from typing import List
from spinn_utilities.overrides import overrides
from spinn_machine import FixedRouteEntry
from spinn_machine import RoutingEntry
from spinnman.exceptions import SpinnmanUnexpectedResponseCodeException
from spinnman.messages.scp import SCPRequestHeader
from spinnman.messages.scp.abstract_messages import (
Expand Down Expand Up @@ -48,11 +48,11 @@ def read_data_bytestring(self, data: bytes, offset: int):
self._route = _ONE_WORD.unpack_from(data, offset)[0]

@property
def route(self) -> FixedRouteEntry:
def route(self) -> RoutingEntry:
"""
Converts this response into a Route
:rtype: FixedRouteEntry
:rtype: RoutingEntry
"""
processor_ids: List[int] = list()
for processor_id in range(26):
Expand All @@ -62,7 +62,7 @@ def route(self) -> FixedRouteEntry:
for link_id in range(6):
if self._route & (1 << link_id) != 0:
link_ids.append(link_id)
return FixedRouteEntry(processor_ids, link_ids)
return RoutingEntry(processor_ids=processor_ids, link_ids=link_ids)


class FixedRouteRead(AbstractSCPRequest[_FixedRouteResponse]):
Expand Down
9 changes: 2 additions & 7 deletions spinnman/processes/get_routes_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from functools import partial
from typing import List, Optional

from spinn_machine import MulticastRoutingEntry, Router
from spinn_machine import MulticastRoutingEntry, RoutingEntry
from spinnman.messages.scp.impl.read_memory import ReadMemory, Response
from spinnman.constants import UDP_MESSAGE_MAX_SIZE

Expand Down Expand Up @@ -64,13 +64,8 @@ def _add_routing_entry(
if self._app_id is not None and self._app_id != app_id:
return

# Convert bit-set into list of (set) IDs
processor_ids, link_ids = \
Router.convert_spinnaker_route_to_routing_ids(route)

self._entries[route_no + offset] = MulticastRoutingEntry(
key, mask, processor_ids=processor_ids, link_ids=link_ids,
defaultable=False)
key, mask, RoutingEntry(spinnaker_route=route))

def __handle_response(self, offset: int, response: Response):
for route_no in range(_ENTRIES_PER_READ):
Expand Down
6 changes: 3 additions & 3 deletions spinnman/processes/load_fixed_route_routing_entry_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from spinn_machine import FixedRouteEntry, Router
from spinn_machine import Router, RoutingEntry
from spinnman.messages.scp.impl import FixedRouteInit
from spinnman.processes import AbstractMultiConnectionProcess

Expand All @@ -24,14 +24,14 @@ class LoadFixedRouteRoutingEntryProcess(AbstractMultiConnectionProcess):
__slots__ = ()

def load_fixed_route(
self, x: int, y: int, fixed_route: FixedRouteEntry,
self, x: int, y: int, fixed_route: RoutingEntry,
app_id: int = 0):
"""
:param int x: The x-coordinate of the chip, between 0 and 255;
this is not checked due to speed restrictions.
:param int y: The y-coordinate of the chip, between 0 and 255;
this is not checked due to speed restrictions.
:param ~spinn_machine.FixedRouteEntry fixed_route:
:param ~spinn_machine.RoutingEntry fixed_route:
the fixed route entry
:param int app_id: The ID of the application with which to associate
the routes. If not specified, defaults to 0.
Expand Down
2 changes: 1 addition & 1 deletion spinnman/processes/load_routes_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_routes(

_ROUTE_PATTERN.pack_into(
routing_data, n_entries * 16, n_entries,
route_entry, route.routing_entry_key, route.mask)
route_entry, route.key, route.mask)
n_entries += 1

# Add an entry to mark the end
Expand Down
8 changes: 4 additions & 4 deletions spinnman/processes/read_fixed_route_routing_entry_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import Optional

from spinn_machine.fixed_route_entry import FixedRouteEntry
from spinn_machine import RoutingEntry
from spinnman.messages.scp.impl.fixed_route_read import (
FixedRouteRead, _FixedRouteResponse)

Expand All @@ -39,13 +39,13 @@ def __init__(self, connection_selector: ConnectionSelector):
the SC&MP connection selector
"""
super().__init__(connection_selector)
self._route: Optional[FixedRouteEntry] = None
self._route: Optional[RoutingEntry] = None

def __handle_read_response(self, response: _FixedRouteResponse):
self._route = response.route

def read_fixed_route(
self, x: int, y: int, app_id: int = 0) -> FixedRouteEntry:
self, x: int, y: int, app_id: int = 0) -> RoutingEntry:
"""
Read the fixed route entry installed on a particular chip's router.
Expand All @@ -56,7 +56,7 @@ def read_fixed_route(
:param int app_id:
The ID of the application with which to associate the
routes. If not specified, defaults to 0.
:rtype: ~spinn_machine.FixedRouteEntry
:rtype: ~spinn_machine.RoutingEntry
"""
with self._collect_responses():
self._send_request(FixedRouteRead(x, y, app_id),
Expand Down
6 changes: 3 additions & 3 deletions spinnman/transceiver/base_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from spinn_utilities.progress_bar import ProgressBar
from spinn_utilities.typing.coords import XY
from spinn_machine import (
CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry)
CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry)
from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag
from spinnman.connections.abstract_classes import Connection
from spinnman.connections.udp_packet_connections import SDPConnection
Expand Down Expand Up @@ -1251,7 +1251,7 @@ def load_multicast_routes(

@overrides(Transceiver.load_fixed_route)
def load_fixed_route(
self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int):
self, x: int, y: int, fixed_route: RoutingEntry, app_id: int):
try:
process = LoadFixedRouteRoutingEntryProcess(
self._scamp_connection_selector)
Expand All @@ -1261,7 +1261,7 @@ def load_fixed_route(
raise

@overrides(Transceiver.read_fixed_route)
def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry:
def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry:
try:
process = ReadFixedRouteRoutingEntryProcess(
self._scamp_connection_selector)
Expand Down
6 changes: 3 additions & 3 deletions spinnman/transceiver/mockable_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from spinn_utilities.progress_bar import ProgressBar
from spinn_utilities.typing.coords import XY
from spinn_machine import (
CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry)
CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry)
from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag
from spinnman.data import SpiNNManDataView
from spinnman.connections.abstract_classes import Connection
Expand Down Expand Up @@ -208,11 +208,11 @@ def load_multicast_routes(

@overrides(Transceiver.load_fixed_route)
def load_fixed_route(
self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int):
self, x: int, y: int, fixed_route: RoutingEntry, app_id: int):
pass

@overrides(Transceiver.read_fixed_route)
def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry:
def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry:
raise NotImplementedError("Needs to be mocked")

@overrides(Transceiver.get_multicast_routes)
Expand Down
8 changes: 4 additions & 4 deletions spinnman/transceiver/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from spinn_utilities.progress_bar import ProgressBar
from spinn_utilities.typing.coords import XY
from spinn_machine import (
CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry)
CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry)
from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag
from spinnman.connections.abstract_classes import Connection
from spinnman.connections.udp_packet_connections import (
Expand Down Expand Up @@ -779,15 +779,15 @@ def load_multicast_routes(

@abstractmethod
def load_fixed_route(
self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int):
self, x: int, y: int, fixed_route: RoutingEntry, app_id: int):
"""
Loads a fixed route routing table entry onto a chip's router.
:param int x:
The x-coordinate of the chip onto which to load the routes
:param int y:
The y-coordinate of the chip onto which to load the routes
:param ~spinn_machine.FixedRouteEntry fixed_route:
:param ~spinn_machine.RoutingEntry fixed_route:
the route for the fixed route entry on this chip
:param int app_id: The ID of the application with which to associate
the routes. If not specified, defaults to 0.
Expand All @@ -804,7 +804,7 @@ def load_fixed_route(
raise NotImplementedError("abstractmethod")

@abstractmethod
def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry:
def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry:
"""
Reads a fixed route routing table entry from a chip's router.
Expand Down

0 comments on commit 3806368

Please sign in to comment.