Skip to content

Commit

Permalink
Revert "Added a subvertex slice to the create_edge function"
Browse files Browse the repository at this point in the history
This reverts commit 8f914c1.
  • Loading branch information
rowleya committed Jun 11, 2015
1 parent 8f914c1 commit fd0dd55
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 33 deletions.
11 changes: 1 addition & 10 deletions pacman/model/partitionable_graph/abstract_partitionable_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,16 @@ def __init__(self, pre_vertex, post_vertex, constraints=None, label=None):
self._post_vertex = post_vertex

@abstractmethod
def create_subedge(self, pre_subvertex, pre_subvertex_slice,
post_subvertex, post_subvertex_slice, constraints=None,
def create_subedge(self, pre_subvertex, post_subvertex, constraints=None,
label=None):
""" Create a subedge between the pre_subvertex and the post_subvertex
:param pre_subvertex: The subvertex at the start of the subedge
:type pre_subvertex:\
:py:class:`pacman.model.partitioned_graph.partitioned_vertex.PartitionedVertex`
:param pre_subvertex_slice: The vertex slice associated with the\
pre_subvertex
:type pre_subvertex_slice:\
:py:class:`pacman.model.graph_mapper.slice.Slice`
:param post_subvertex: The subvertex at the end of the subedge
:type post_subvertex:\
:py:class:`pacman.model.partitioned_graph.partitioned_vertex.PartitionedVertex`
:param post_subvertex_slice: The vertex_slice associated with the\
post_subvertex
:type post_subvertex_slice:\
:py:class:`pacman.model.graph_mapper.slice.Slice`
:param constraints: The constraints of the vertex
:type constraints: iterable of\
:py:class:`pacman.model.constraints.abstract_constraint.AbstractConstraint`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ def is_partitionable_edge(self):
"""
return True

def create_subedge(self, pre_subvertex, pre_subvertex_slice,
post_subvertex, post_subvertex_slice, label=None,
def create_subedge(self, pre_subvertex, post_subvertex, label=None,
constraints=None):
"""
method to create a fixed route partitioned edge from a fixed route
partitionable edge
:param pre_subvertex: the soruce subvertex
:param post_subvertex: the destination partitioned subvertex
:param label: the label associated with the partitioned edge
:param constraints: any contraints needed for the partitioned edge
:return: the FixedRoutePartitionedEdge
"""
if not isinstance(pre_subvertex, PartitionedVertex):
raise exceptions.PacmanInvalidParameterException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ def is_partitionable_edge(self):
"""
return True

def create_subedge(self, pre_subvertex, pre_subvertex_slice,
post_subvertex, post_subvertex_slice, label=None,
def create_subedge(self, pre_subvertex, post_subvertex, label=None,
constraints=None):
"""
method for creating a partitioned multicast edge
:param pre_subvertex: the soruce partitioned vertex
:param post_subvertex: the destination partitioned vertex
:param label: the label of this partitioned edge
:param constraints: the constraints wnated to be put on this
partitioned edge
:return:
"""
if not isinstance(pre_subvertex, PartitionedVertex):
raise exceptions.PacmanInvalidParameterException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def _generate_sub_edges(subgraph, graph_to_subgraph_mapper, graph):

# For each out edge of the parent vertex...
vertex = graph_to_subgraph_mapper.get_vertex_from_subvertex(src_sv)
src_sv_slice = graph_to_subgraph_mapper.get_subvertex_slice(src_sv)
out_edges = graph.outgoing_edges_from_vertex(vertex)
for edge in out_edges:

Expand All @@ -77,10 +76,7 @@ def _generate_sub_edges(subgraph, graph_to_subgraph_mapper, graph):
post_subverts = (graph_to_subgraph_mapper
.get_subvertices_from_vertex(post_vertex))
for dst_sv in post_subverts:
dst_sv_slice = (graph_to_subgraph_mapper
.get_subvertex_slice(dst_sv))
subedge = edge.create_subedge(src_sv, src_sv_slice,
dst_sv, dst_sv_slice)
subedge = edge.create_subedge(src_sv, dst_sv)
subgraph.add_subedge(subedge)
graph_to_subgraph_mapper.add_partitioned_edge(
subedge, edge)
Expand Down
8 changes: 3 additions & 5 deletions uinit_test_objects/test_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def __init__(self, pre_vertex, post_vertex, label=None, constraints=None):
AbstractPartitionableEdge.__init__(
self, pre_vertex, post_vertex, constraints, label)

def create_subedge(self, pre_subvertex, pre_subvertex_slice,
post_subvertex, post_subvertex_slice, constraints=None,
def create_subedge(self, pre_subvertex, post_subvertex, constraints=None,
label=None):
""" method to create subedges
Expand All @@ -30,13 +29,12 @@ def create_subedge(self, pre_subvertex, pre_subvertex_slice,
else:
constraints = self._constraints
print constraints
return MultiCastPartitionedEdge(pre_subvertex, pre_subvertex_slice,
post_subvertex, post_subvertex_slice,
return MultiCastPartitionedEdge(pre_subvertex, post_subvertex,
label, constraints)

def is_partitionable_edge(self):
""" helper for isinstance
:return:
"""
return True
return True
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,17 @@ def test_create_subvertex_from_vertex_with_previous_constraints(self):
"""
constraint1 = KeyAllocatorContiguousRangeContraint()
vert1 = TestVertex(10, "New AbstractConstrainedVertex", 256)
subv_from_vert1_slice = Slice(0, 9)
subv_from_vert1 = vert1.create_subvertex(
subv_from_vert1_slice,
vert1.get_resources_used_by_atoms(subv_from_vert1_slice, None))
Slice(0, 9),
vert1.get_resources_used_by_atoms(Slice(0, 9), None))
vert2 = TestVertex(10, "New AbstractConstrainedVertex", 256)
subv_from_vert2_slice = Slice(0, 9)
subv_from_vert2 = vert2.create_subvertex(
subv_from_vert2_slice,
vert2.get_resources_used_by_atoms(subv_from_vert2_slice, None))
Slice(0, 9),
vert2.get_resources_used_by_atoms(Slice(0, 9), None))
edge1 = TestPartitionableEdge(vert1, vert2, "edge 1")
edge1.add_constraint(constraint1)

subedge = edge1.create_subedge(subv_from_vert1, subv_from_vert1_slice,
subv_from_vert2, subv_from_vert2_slice)
subedge = edge1.create_subedge(subv_from_vert1, subv_from_vert2)
self.assertIn(constraint1, subedge.constraints)

def test_new_create_subvertex_from_vertex_no_constraints(self):
Expand Down Expand Up @@ -155,4 +152,4 @@ def test_create_new_subedge_from_edge(self):
edge1 = TestPartitionableEdge(vert1, vert2, "First edge")
subedge1 = edge1.create_subedge(subv_from_vert1, subv_from_vert2,
None, "First sub edge")
self.assertEqual(subedge1.label, "First sub edge")
self.assertEqual(subedge1.label, "First sub edge")

0 comments on commit fd0dd55

Please sign in to comment.