pacman.operations.router_compressors package

Subpackages

Submodules

pacman.operations.router_compressors.routing_compression_checker module

pacman.operations.router_compressors.routing_compression_checker.calc_remainders(o_code: str, c_code: str) List[str][source]
Parameters:
  • o_code (str) – Codified original route

  • c_code (str) – Codified compressed route

Return type:

list(str)

pacman.operations.router_compressors.routing_compression_checker.codify(route: MulticastRoutingEntry, length: int = 32) str[source]

This method discovers all the routing keys covered by this route.

Starts of with the assumption that the key is always covered.

Whenever a mask bit is zero the list of covered keys is doubled to include both the key with a zero and a one at that place.

Parameters:
  • route (MulticastRoutingEntry) – single routing entry

  • length (int) – length in bits of the key and mask (defaults to 32)

Returns:

set of routing_keys covered by this route

Return type:

str

pacman.operations.router_compressors.routing_compression_checker.codify_table(table: AbstractMulticastRoutingTable, length: int = 32) Dict[str, MulticastRoutingEntry][source]

Apply codify() to all entries in a table.

Parameters:
Returns:

mapping from codified route to routing entry

Return type:

dict(str, MulticastRoutingEntry)

pacman.operations.router_compressors.routing_compression_checker.compare_route(o_route: MulticastRoutingEntry, compressed_dict: Dict[str, MulticastRoutingEntry], o_code: str | None = None, start: int = 0, f: TextIO | None = None)[source]
Parameters:
pacman.operations.router_compressors.routing_compression_checker.compare_tables(original: AbstractMulticastRoutingTable, compressed: AbstractMulticastRoutingTable)[source]

Compares the two tables without generating any output.

Parameters:
Raises:

PacmanRoutingException if there is any error

pacman.operations.router_compressors.routing_compression_checker.covers(o_code: str, c_code: str) bool[source]
Parameters:
Return type:

bool

Module contents

class pacman.operations.router_compressors.AbstractCompressor(ordered: bool = True, accept_overflow: bool = False)

Bases: object

Basic model of a router table compressor.

Note

Not all compressors use this model.

compress_all_tables() MulticastRoutingTables[source]

Apply compression to all uncompressed tables.

Return type:

MulticastRoutingTables

abstract compress_table(router_table: UnCompressedMulticastRoutingTable) List[MulticastRoutingEntry][source]
Parameters:

router_table (UnCompressedMulticastRoutingTable) – Original routing table for a single chip

Returns:

Raw compressed routing table entries for the same chip

Return type:

list(MulticastRoutingEntry)

compress_tables(router_tables: MulticastRoutingTables, progress: ProgressBar) MulticastRoutingTables[source]

Compress the given unordered routing tables.

Tables who start of smaller than global_target are not compressed

Parameters:
Returns:

The compressed but still unordered routing tables

Return type:

MulticastRoutingTables

Raises:

MinimisationFailedError – on failure

class pacman.operations.router_compressors.RangeCompressor

Bases: object

A compressor based on ranges. Use via range_compressor().

compress_table(uncompressed: UnCompressedMulticastRoutingTable) AbstractMulticastRoutingTable[source]

Compresses all the entries for a single table.

Compressed the entries for this unordered table returning a new table with possibly fewer entries

Parameters:

uncompressed (UnCompressedMulticastRoutingTable) – Original Routing table for a single chip

Returns:

Compressed routing table for the same chip

Return type:

AbstractMulticastRoutingTable

pacman.operations.router_compressors.pair_compressor(ordered: bool = True, accept_overflow: bool = False, verify: bool = False, c_sort=False)
Parameters:
  • accept_overflow (bool) – A flag which should only be used in testing to stop raising an exception if result is too big

  • verify (bool) – If set to true will verify the length before returning

  • c_sort (bool) – If set will use the slower quick sort as it is implemented in c/ on cores

Return type:

MulticastRoutingTables

pacman.operations.router_compressors.range_compressor(accept_overflow: bool = True) MulticastRoutingTables
Parameters:

accept_overflow (bool) – A flag which should only be used in testing to stop raising an exception if result is too big

Return type:

MulticastRoutingTables