Skip to content

Commit

Permalink
Merge pull request #543 from SpiNNakerManchester/split_processors
Browse files Browse the repository at this point in the history
Split processors into monitor and user
  • Loading branch information
rowleya committed Mar 5, 2024
2 parents ef0038e + 882d93d commit ecade56
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
13 changes: 9 additions & 4 deletions pacman/operations/fixed_route_router/fixed_route_router.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 typing import Dict, List, Tuple
from typing import Dict, List, Tuple, Type
from spinn_utilities.progress_bar import ProgressBar
from spinn_machine import Chip, FixedRouteEntry
from pacman.data import PacmanDataView
Expand All @@ -22,12 +22,12 @@


def fixed_route_router(
destination_class) -> Dict[Tuple[int, int], FixedRouteEntry]:
destination_class: Type) -> Dict[Tuple[int, int], FixedRouteEntry]:
"""
Runs the fixed route generator for all boards on machine.
:param destination_class: the destination class to route packets to
:type destination_class: type or tuple(type,...)
:type destination_class: type
:return: router tables for fixed route paths
:rtype: dict((int, int)), ~spinn_machine.FixedRouteEntry)
:raises PacmanConfigurationException: if no placement processor found
Expand All @@ -48,7 +48,12 @@ class _FixedRouteRouter(object):
"_destination_class", "_fixed_route_tables",
"_machine")

def __init__(self, destination_class):
def __init__(self, destination_class: Type):
"""
:param destination_class: the destination class to route packets to
:type destination_class: type
"""
self._machine = PacmanDataView.get_machine()
self._destination_class = destination_class
self._fixed_route_tables: Dict[Tuple[int, int], FixedRouteEntry] = \
Expand Down
6 changes: 2 additions & 4 deletions pacman/operations/placer_algorithms/application_placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ def _do_fixed_location(
f"Constrained to chip {x, y} but no such chip")
on_chip = placements.placements_on_chip(x, y)
cores_used = {p.p for p in on_chip}
cores = set(p.processor_id for p in chip.processors
if not p.is_monitor) - cores_used
cores = set(chip.user_processors_ids) - cores_used
next_cores = iter(cores)
for vertex in vertices:
next_core = None
Expand Down Expand Up @@ -552,8 +551,7 @@ def __init__(
:param int used_sdram:
"""
self.chip = chip
self.cores = set(p.processor_id for p in chip.processors
if not p.is_monitor)
self.cores = set(chip.user_processors_ids)
self.cores -= used_processors
self.sdram = chip.sdram - used_sdram

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ def do_too_many_ip_tags_for_1_board(self, machine):
eth_chips = machine.ethernet_connected_chips
eth_chip = eth_chips[0]
eth_chip_2 = machine.get_chip_at(eth_chip.x + 1, eth_chip.y + 1)
eth_procs = [
proc.processor_id for proc in eth_chip.processors
if not proc.is_monitor]
procs = [proc for proc in eth_chip_2.processors if not proc.is_monitor]
eth_procs = list(eth_chip.user_processors_ids)
procs = list(eth_chip_2.user_processors)
eth2_procs = [proc.processor_id for proc in procs]
proc = procs[-1]
eth_vertices = [
Expand Down Expand Up @@ -125,17 +123,15 @@ def test_fixed_tag(self):
machine = virtual_machine(8, 8)
writer.set_machine(machine)
chip00 = machine.get_chip_at(0, 0)
procs = [
proc.processor_id for proc in chip00.processors
if not proc.is_monitor]
procs = chip00.user_processors_ids
placements = Placements()
for i in range(5):
vertex = SimpleMachineVertex(
sdram=ConstantSDRAM(0),
iptags=[IPtagResource(
"127.0.0.1", port=10000 + i, strip_sdp=True, tag=1+i)],
label="Vertex {i}")
placements.add_placement(Placement(vertex, 0, 0, procs[i]))
placements.add_placement(Placement(vertex, 0, 0, next(procs)))
writer.set_placements(placements)
writer.set_plan_n_timesteps(1000)
tags = basic_tag_allocator()
Expand All @@ -146,9 +142,7 @@ def do_fixed_repeat_tag(self, machine):
writer = PacmanDataWriter.mock()
writer.set_machine(machine)
chip00 = machine.get_chip_at(0, 0)
procs = [
proc.processor_id for proc in chip00.processors
if not proc.is_monitor]
procs = chip00.user_processors_ids
placements = Placements()
for i in range(3):
vertex = SimpleMachineVertex(
Expand All @@ -158,7 +152,7 @@ def do_fixed_repeat_tag(self, machine):
IPtagResource("127.45.0.1", port=10000 + i,
strip_sdp=True, tag=1+i)],
label=f"Vertex {i}")
placements.add_placement(Placement(vertex, 0, 0, procs[i]))
placements.add_placement(Placement(vertex, 0, 0, next(procs)))
writer.set_placements(placements)
writer.set_plan_n_timesteps(1000)
tags = basic_tag_allocator()
Expand All @@ -182,14 +176,12 @@ def do_reverse(self, machine):
writer = PacmanDataWriter.mock()
writer.set_machine(machine)
chip00 = machine.get_chip_at(0, 0)
procs = [
proc.processor_id for proc in chip00.processors
if not proc.is_monitor]
processor = chip00.get_first_none_monitor_processor()
placements = Placements()
vertex = SimpleMachineVertex(
sdram=ConstantSDRAM(0),
reverse_iptags=[ReverseIPtagResource(port=10000, tag=1)])
placements.add_placement(Placement(vertex, 0, 0, procs[1]))
placements.add_placement(Placement(vertex, 0, 0, processor))
writer.set_placements(placements)
writer.set_plan_n_timesteps(1000)
tags = basic_tag_allocator()
Expand Down

0 comments on commit ecade56

Please sign in to comment.