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 Mar 30, 2023
2 parents f95d3d3 + 25461af commit 975e20d
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 80 deletions.
4 changes: 2 additions & 2 deletions pacman/model/graphs/abstract_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def pre_vertex(self):
"""
The vertex at the start of the edge.
:rtype: AbstractVertex
:rtype: ~pacman.model.graphs.AbstractVertex
"""

@abstractproperty
def post_vertex(self):
"""
The vertex at the end of the edge.
:rtype: AbstractVertex
:rtype: ~pacman.model.graphs.AbstractVertex
"""
9 changes: 4 additions & 5 deletions pacman/model/graphs/abstract_edge_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ def add_edge(self, edge):
"""
Add an edge to the edge partition.
:param AbstractEdge edge: the edge to add
:param ~pacman.model.graphs.AbstractEdge edge: the edge to add
:raises PacmanInvalidParameterException:
If the edge does not belong in this edge partition
"""

# Check for an incompatible edge
if not isinstance(edge, self._allowed_edge_types):
raise PacmanInvalidParameterException(
Expand Down Expand Up @@ -82,7 +81,7 @@ def edges(self):
The order in which the edges are added is preserved for when they
are requested later. If not, please talk to the software team.
:rtype: iterable(AbstractEdge)
:rtype: iterable(~pacman.model.graphs.AbstractEdge)
"""
return self._edges

Expand All @@ -106,7 +105,7 @@ def __contains__(self, edge):
"""
Check if the edge is contained within this partition.
:param AbstractEdge edge: the edge to search for.
:param ~pacman.model.graphs.AbstractEdge edge: the edge to search for.
:rtype: bool
"""
return edge in self._edges
Expand All @@ -121,5 +120,5 @@ def pre_vertices(self):
:py:class:`AbstractSingleSourcePartition`
and therefore provide the ``pre_vertex`` method.
:rtype: iter(AbstractVertex)
:rtype: iterable(~pacman.model.graphs.AbstractVertex)
"""
2 changes: 1 addition & 1 deletion pacman/model/graphs/abstract_single_source_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def pre_vertex(self):
"""
The vertex at which all edges in this outgoing edge partition start.
:rtype: AbstractVertex
:rtype: ~pacman.model.graphs.AbstractVertex
"""
return self._pre_vertex

Expand Down
4 changes: 3 additions & 1 deletion pacman/model/graphs/abstract_supports_sdram_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ def sdram_requirement(self, sdram_machine_edge):
"""
Asks a machine vertex for the SDRAM requirement it needs.
:param SDRAMMachineEdge sdram_machine_edge:
:param sdram_machine_edge:
The SDRAM edge in question
:type sdram_machine_edge:
~pacman.model.graphs.machine.SDRAMMachineEdge
:return: The size in bytes this vertex needs for the SDRAM edge.
:rtype: int (most likely a multiple of 4)
"""
2 changes: 1 addition & 1 deletion pacman/model/graphs/abstract_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_fixed_location(self):
Used instead of `ChipAndCoreConstraint`.
:rtype: None or ChipAndCore
:rtype: None or ~pacman.model.graphs.common.ChipAndCore
"""
return self._fixed_location

Expand Down
4 changes: 2 additions & 2 deletions pacman/model/graphs/abstract_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AbstractVirtual(object):
.. note::
Everything that is an instance of ``AbstractVirtual`` is also an
instance of :py:class:`AbstractVertex`.
instance of :py:class:`~pacman.model.graphs.AbstractVertex`.
"""

__slots__ = ()
Expand Down Expand Up @@ -55,7 +55,7 @@ def outgoing_keys_and_masks(self):
Get the keys sent by the device or `None` if there aren't any
explicitly defined.
:rtype: list(BaseKeyAndMask) or None
:rtype: list(~pacman.model.routing_info.BaseKeyAndMask) or None
"""

@abstractproperty
Expand Down
6 changes: 4 additions & 2 deletions pacman/model/graphs/application/application_2d_fpga_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ def __init__(
The connections from one or more FPGAs that that packets are
expected to be received from for this device, or `None` if no
incoming traffic is expected from the device
:type incoming_fpga_connections: list(FPGAConnection) or None
:type incoming_fpga_connections:
list(~pacman.model.graphs.application.FPGAConnection) or None
:param outgoing_fpga_connection:
The connection to an FPGA that packets to be sent to this device
should be sent down, or `None` if no outgoing traffic is expected
to be sent to the device.
:type outgoing_fpga_connection: FPGAConnection or None
:type outgoing_fpga_connection:
~pacman.model.graphs.application.FPGAConnection or None
:param str label: The optional name of the vertex.
"""
# Set variables first as this lets us call properties
Expand Down
8 changes: 2 additions & 6 deletions pacman/model/graphs/application/application_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,12 @@ class ApplicationEdge(AbstractEdge):

def __init__(self, pre_vertex, post_vertex, label=None):
"""
:param ApplicationVertex pre_vertex:
:param ~pacman.model.graphs.application.ApplicationVertex pre_vertex:
The application vertex at the start of the edge.
:param ApplicationVertex post_vertex:
:param ~pacman.model.graphs.application.ApplicationVertex post_vertex:
The application vertex at the end of the edge.
:param label: The name of the edge.
:type label: str or None
:param machine_edge_type:
The type of machine edges made from this app edge. If ``None``,
standard machine edges will be made.
:type machine_edge_type: type(MachineEdge)
"""
self._label = label
self._pre_vertex = pre_vertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class ApplicationEdgePartition(AbstractSingleSourcePartition):
def __init__(self, identifier, pre_vertex):
"""
:param str identifier: The identifier of the partition
:param ApplicationVertex pre_vertex: The source of this partition
:param ~pacman.model.graphs.application.ApplicationVertex pre_vertex:
The source of this partition
"""
super().__init__(
pre_vertex=pre_vertex, identifier=identifier,
Expand Down
14 changes: 8 additions & 6 deletions pacman/model/graphs/application/application_fpga_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ def __init__(
The connections from one or more FPGAs that that packets are
expected to be received from for this device, or `None` if no
incoming traffic is expected from the device
:type incoming_fpga_connections: list(FPGAConnection) or None
:type incoming_fpga_connections:
list(~pacman.model.graphs.application.FPGAConnection) or None
:param outgoing_fpga_connection:
The connection to an FPGA that packets to be sent to this device
should be sent down, or `None` if no outgoing traffic is expected
to be sent to the device.
:type outgoing_fpga_connection: FPGAConnection or None
:type outgoing_fpga_connection:
~pacman.model.graphs.application.FPGAConnection or None
:param str label: The optional name of the vertex.
:param int n_machine_vertices_per_link:
The optional number of machine vertices to create for each FPGA
Expand Down Expand Up @@ -81,11 +83,11 @@ def get_incoming_slice_for_link(self, link, index):
"""
Get the slice to be given to the connection from the given link.
:param FPGAConnection link: The FPGA connection to get the slice for
:param ~pacman.model.graphs.application.FPGAConnection link:
The FPGA connection to get the slice for
:param int index:
The index of the connection on the FGPA link, for when
n_machine_vertices_per_link > 1
:rtype: ~pacman.model.graphs.common.Slice
"""
# pylint: disable=unused-argument
Expand All @@ -109,7 +111,7 @@ def incoming_fpga_connections(self):
The connections from one or more FPGAs that packets are expected
to be received from for this device.
:rtype: iter(FPGAConnection)
:rtype: iterable(~pacman.model.graphs.application.FPGAConnection)
"""
if self._incoming_fpga_connections:
for conn in self._incoming_fpga_connections:
Expand All @@ -121,7 +123,7 @@ def outgoing_fpga_connection(self):
The connection to one FPGA via one link to which packets are sent
to this device.
:rtype: FPGAConnection or None
:rtype: ~pacman.model.graphs.application.FPGAConnection or None
"""
return self._outgoing_fpga_connection

Expand Down
32 changes: 18 additions & 14 deletions pacman/model/graphs/application/application_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def add_vertex(self, vertex):
"""
Add a vertex to the graph.
:param ApplicationVertex vertex: The vertex to add
:param ~pacman.model.graphs.application.ApplicationVertex vertex:
The vertex to add
:raises PacmanInvalidParameterException:
If the vertex is not of a valid type
:raises PacmanConfigurationException:
Expand All @@ -72,7 +73,7 @@ def vertices(self):
"""
The vertices in the graph.
:rtype: iterable(AbstractVertex)
:rtype: iterable(~pacman.model.graphs.AbstractVertex)
"""
return self._vertex_by_label.values()

Expand All @@ -94,13 +95,13 @@ def add_edge(self, edge, outgoing_edge_partition_name):
If required and possible will create a new partition in the graph
Returns the partition the edge was added to
:param ApplicationEdge edge: The edge to add
:param ~pacman.model.graphs.application.ApplicationEdge edge:
The edge to add
:param str outgoing_edge_partition_name:
The name of the edge partition to add the edge to; each edge
partition is the partition of edges that start at the same vertex
:rtype: AbstractEdgePartition
:return: The partition the edge was added to.
:rtype: ~pacman.model.graphs.AbstractEdgePartition
:raises PacmanInvalidParameterException:
If the edge is not of a valid type or if edges have already been
added to this partition that start at a different vertex to this
Expand All @@ -122,7 +123,8 @@ def _check_edge(self, edge):
"""
Add an edge to the graph.
:param ApplicationEdge edge: The edge to add
:param ~pacman.model.graphs.application.ApplicationEdge edge:
The edge to add
:raises PacmanInvalidParameterException:
If the edge is not of a valid type or if edges have already been
added to this partition that start at a different vertex to this
Expand Down Expand Up @@ -150,7 +152,7 @@ def edges(self):
"""
The edges in the graph.
:rtype: iterable(AbstractEdge)
:rtype: iterable(~pacman.model.graphs.AbstractEdge)
"""
return [
edge
Expand All @@ -163,7 +165,9 @@ def _add_outgoing_edge_partition(self, edge_partition):
Will also add any edges already in the partition as well
:param ApplicationEdgePartition edge_partition:
:param edge_partition:
:type edge_partition:
~pacman.model.graphs.application.ApplicationEdgePartition
"""
self._outgoing_edge_partitions_by_pre_vertex[
edge_partition.pre_vertex].add(edge_partition)
Expand All @@ -174,7 +178,7 @@ def outgoing_edge_partitions(self):
"""
The edge partitions in the graph.
:rtype: iterable(AbstractEdgePartition)
:rtype: iterable(~pacman.model.graphs.AbstractEdgePartition)
"""
for partitions in \
self._outgoing_edge_partitions_by_pre_vertex.values():
Expand All @@ -194,9 +198,9 @@ def get_outgoing_edge_partitions_starting_at_vertex(self, vertex):
"""
Get all the edge partitions that start at the given vertex.
:param AbstractVertex vertex:
:param ~pacman.model.graphs.AbstractVertex vertex:
The vertex at which the edge partitions to find starts
:rtype: iterable(AbstractEdgePartition)
:rtype: iterable(~pacman.model.graphs.AbstractEdgePartition)
"""
return self._outgoing_edge_partitions_by_pre_vertex[vertex]

Expand All @@ -206,13 +210,13 @@ def get_outgoing_edge_partition_starting_at_vertex(
Get the given outgoing edge partition that starts at the
given vertex, or `None` if no such edge partition exists.
:param AbstractVertex vertex:
:param ~pacman.model.graphs.AbstractVertex vertex:
The vertex at the start of the edges in the partition
:param str outgoing_edge_partition_name:
The name of the edge partition
:return:
The named edge partition, or `None` if no such partition exists
:rtype: AbstractEdgePartition or None
:rtype: ~pacman.model.graphs.AbstractEdgePartition or None
"""
# In general, very few partitions start at a given vertex, so iteration
# isn't going to be as onerous as it looks
Expand Down
23 changes: 14 additions & 9 deletions pacman/model/graphs/application/application_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def remember_machine_vertex(self, machine_vertex):
"""
Adds the machine vertex to the iterable returned by machine_vertices
:param MachineVertex machine_vertex: A pointer to a machine_vertex
:param ~pacman.model.graphs.machine.MachineVertex machine_vertex:
A pointer to a machine_vertex
"""
machine_vertex.index = len(self._machine_vertices)
self._machine_vertices.add(machine_vertex)
Expand All @@ -137,9 +138,10 @@ def n_atoms(self):

def round_n_atoms(self, n_atoms, label="n_atoms"):
"""
Utility function to allow suoer-classes to make sure n_atom is an int.
Utility function to allow suoer-classes to make sure `n_atoms` is an
integer.
:param n_atoms: Value convertible to int to be used for n_atoms
:param n_atoms: Value convertible to int to be used for `n_atoms`
:type n_atoms: int or float or numpy.
:return: Number of atoms.
:rtype: int
Expand All @@ -163,7 +165,7 @@ def machine_vertices(self):
"""
The machine vertices that this application vertex maps to.
:rtype: iterable(MachineVertex)
:rtype: iterable(~pacman.model.graphs.machine.MachineVertex)
"""
return self._machine_vertices

Expand Down Expand Up @@ -233,11 +235,11 @@ def get_machine_fixed_key_and_mask(self, machine_vertex, partition_id):
this to return `None` and get_fixed_key_and_mask to return not `None`
iff there is only one machine vertex.
:param MachineVertex machine_vertex:
:param ~pacman.model.graphs.machine.MachineVertex machine_vertex:
A source machine vertex of this application vertex
:param str partition_id:
The identifier of the partition to get the key for
:rtype: BaseKeyAndMask or None
:rtype: ~pacman.model.routing_info.BaseKeyAndMask or None
"""
# pylint: disable=unused-argument
return None
Expand All @@ -250,7 +252,7 @@ def get_fixed_key_and_mask(self, partition_id):
:param str partition_id:
The identifier of the partition to get the key for
:rtype: BaseKeyAndMask or None
:rtype: ~pacman.model.routing_info.BaseKeyAndMask or None
"""
# pylint: disable=unused-argument
return None
Expand All @@ -260,6 +262,9 @@ def add_incoming_edge(self, edge, partition):
Add an edge incoming to this vertex. This is ignored by default,
but could be used to track incoming edges, and/or report faults.
:param ApplicationEdge edge:
:param ApplicationEdgePartition partition:
:param ~pacman.model.graphs.application.ApplicationEdge edge:
The edge to add.
:param partition: The partition to add the edge to.
:type partition:
~pacman.model.graphs.application.ApplicationEdgePartition
"""
6 changes: 4 additions & 2 deletions pacman/model/graphs/machine/abstract_sdram_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def get_sdram_base_address_for(self, vertex):
Get the SDRAM base address for a edge given which side
the vertex is on.
:param MachineVertex vertex: the vertex to find SDRAM base address of
:param ~pacman.model.graphs.machine.MachineVertex vertex:
the vertex to find SDRAM base address of
:return: the SDRAM address for this vertex
:rtype: int
"""
Expand All @@ -43,7 +44,8 @@ def get_sdram_size_of_region_for(self, vertex):
"""
Get the size of the region for a vertex given a edge.
:param MachineVertex vertex: the vertex to find SDRAM size of
:param ~pacman.model.graphs.machine.MachineVertex vertex:
the vertex to find SDRAM size of
:return: the SDRAM size for this vertex
:rtype: int
"""
Loading

0 comments on commit 975e20d

Please sign in to comment.