Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-stokes committed Apr 2, 2015
2 parents 856172e + 1d3965c commit c8cf9c2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
15 changes: 13 additions & 2 deletions pacman/model/partitionable_graph/fixed_route_partitionable_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ def is_partitionable_edge(self):
"""
return True

def create_subedge(self, pre_subvertex, post_subvertex, 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(
"pre_subvertex", str(pre_subvertex),
Expand All @@ -47,4 +57,5 @@ def create_subedge(self, pre_subvertex, post_subvertex, label=None):
if label is None and self.label is not None:
label = self.label

return FixedRoutePartitionedEdge(pre_subvertex, post_subvertex, label)
return FixedRoutePartitionedEdge(pre_subvertex, post_subvertex, label,
constraints)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class FixedRoutePartitionedEdge(AbstractPartitionedEdge):
vertices on either side of the edge
"""

def __init__(self, pre_subvertex, post_subvertex, label=None):
def __init__(self, pre_subvertex, post_subvertex, label=None,
constraints=None):
"""
:param pre_subvertex: the subvertex at the start of the subedge
Expand All @@ -18,10 +19,13 @@ def __init__(self, pre_subvertex, post_subvertex, label=None):
:py:class:`pacman.model.partitioned_graph.partitioned_vertex.PartitionedVertex`
:param label: The name of the edge
:type label: str
:param constraints: constraints for the partituioned edge
:type constraints: iterable of
pacman.model.constraints.abstract_constraints.abstract_Constraint.AbstractConstraint
:raise None: Raises no known exceptions
"""
AbstractPartitionedEdge.__init__(self, pre_subvertex, post_subvertex,
label)
constraints, label)

def is_partitioned_edge(self):
""" helper method for is instance
Expand Down
8 changes: 6 additions & 2 deletions pacman/model/partitioned_graph/multi_cast_partitioned_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class MultiCastPartitionedEdge(AbstractPartitionedEdge):
vertices on either side of the edge
"""

def __init__(self, pre_subvertex, post_subvertex, label=None):
def __init__(self, pre_subvertex, post_subvertex, label=None,
constraints=None):
"""
:param pre_subvertex: the subvertex at the start of the subedge
Expand All @@ -18,10 +19,13 @@ def __init__(self, pre_subvertex, post_subvertex, label=None):
:py:class:`pacman.model.partitioned_graph.subvertex.PartitionedVertex`
:param label: The name of the edge
:type label: str
:param constraints: constraitns for this edge
:type constraints: iterable of :
pacman.model.constraints.abstract_constraints.abstract_constraint.AbstractConstraint
:raise None: Raises no known exceptions
"""
AbstractPartitionedEdge.__init__(self, pre_subvertex, post_subvertex,
label)
constraints, label)

def is_partitioned_edge(self):
""" helper method for is instance
Expand Down
5 changes: 5 additions & 0 deletions pacman/model/placements/placement.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Placement file
"""


class Placement(object):
""" Represents a placement of a subvertex on a specific processor on a\
specific chip in the machine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ def _do_allocation(self, index, base_key, n_keys):
if free_space_slot.start_address > base_key:
raise PacmanRouteInfoAllocationException(
"Trying to allocate a key in the wrong slot!")
if n_keys == 0 or ((n_keys % 2) != 0):
# TODO check with rowley over this check. as it kills the heat demo
"""if n_keys == 0 or ((n_keys % 2) != 0):
raise PacmanRouteInfoAllocationException(
"Trying to allocate {} keys, which is not a power of 2"
.format(n_keys))
.format(n_keys))"""

# Check if there is enough space to allocate
space = self._check_allocation(index, base_key, n_keys)
Expand Down

0 comments on commit c8cf9c2

Please sign in to comment.