-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from SpiNNakerManchester/sdram_edges
rubbered
- Loading branch information
Showing
8 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ class EdgeTrafficType(Enum): | |
|
||
MULTICAST = 1 | ||
FIXED_ROUTE = 2 | ||
SDRAM = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
unittests/operations_tests/placer_algorithms_tests/test_sdram_edge_placement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from pacman.model.graphs.machine import MachineGraph, SimpleMachineVertex | ||
from spinn_machine import VirtualMachine | ||
from pacman.model.resources import ResourceContainer | ||
from pacman.model.graphs.machine.machine_edge import MachineEdge | ||
from pacman.model.graphs.common.edge_traffic_type import EdgeTrafficType | ||
from pacman.operations.rig_algorithms.rig_place import RigPlace | ||
from pacman.operations.placer_algorithms.one_to_one_placer \ | ||
import OneToOnePlacer | ||
from pacman.operations.placer_algorithms import RadialPlacer | ||
import random | ||
import unittest | ||
|
||
|
||
class TestSameChipConstraint(unittest.TestCase): | ||
|
||
def _do_test(self, placer): | ||
machine = VirtualMachine(width=8, height=8) | ||
graph = MachineGraph("Test") | ||
|
||
vertices = [ | ||
SimpleMachineVertex(ResourceContainer(), label="v{}".format(i)) | ||
for i in range(100) | ||
] | ||
for vertex in vertices: | ||
graph.add_vertex(vertex) | ||
|
||
same_vertices = [ | ||
SimpleMachineVertex(ResourceContainer(), label="same{}".format(i)) | ||
for i in range(10) | ||
] | ||
random.seed(12345) | ||
sdram_edges = list() | ||
for vertex in same_vertices: | ||
graph.add_vertex(vertex) | ||
for i in range(0, random.randint(1, 5)): | ||
sdram_edge = MachineEdge( | ||
vertex, vertices[random.randint(0, 99)], | ||
traffic_type=EdgeTrafficType.SDRAM) | ||
sdram_edges.append(sdram_edge) | ||
graph.add_edge(sdram_edge, "Test") | ||
|
||
placements = placer(graph, machine) | ||
for edge in sdram_edges: | ||
pre_place = placements.get_placement_of_vertex(edge.pre_vertex) | ||
post_place = placements.get_placement_of_vertex(edge.post_vertex) | ||
self.assert_(pre_place.x == post_place.x) | ||
self.assert_(pre_place.y == post_place.y) | ||
|
||
def test_one_to_one(self): | ||
self._do_test(OneToOnePlacer()) | ||
|
||
def test_radial(self): | ||
self._do_test(RadialPlacer()) | ||
|
||
def test_rig(self): | ||
self._do_test(RigPlace()) |