pacman.operations.router_compressors package

Subpackages

Submodules

pacman.operations.router_compressors.routing_compression_checker module

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 – single routing entry

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

Returns:

set of routing_keys covered by this route

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:
  • table

  • length

Returns:

mapping from codified route to routing entry

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) None[source]

Compare that the compressed route is correct.

Parameters:
  • o_route – the original route

  • compressed_dict – Compressed routes

  • o_code – Codified original route (if known)

  • start – Starting index in compressed routes

  • f – Where to write (part of) the route report

pacman.operations.router_compressors.routing_compression_checker.compare_tables(original: AbstractMulticastRoutingTable, compressed: AbstractMulticastRoutingTable) None[source]

Compares the two tables without generating any output.

Parameters:
  • original – The original routing tables

  • compressed – The compressed routing tables. Which will be considered in order.

Raises:

PacmanRoutingException if there is any error

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.

Parameters:
  • ordered – Flag to say if the results can be order dependent

  • accept_overflow – Flag to say that results too large should be ignored

compress_all_tables() MulticastRoutingTables[source]

Apply compression to all uncompressed tables.

Returns:

Compressed routing tables

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

router_table – Original routing table for a single chip

Returns:

Raw compressed routing table entries for the same chip

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:
  • router_tables – Routing tables

  • progress – Progress bar to show while working

Returns:

The compressed but still unordered routing tables

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 – Original Routing table for a single chip

Returns:

Compressed routing table for the same chip

pacman.operations.router_compressors.pair_compressor(ordered: bool = True, accept_overflow: bool = False, verify: bool = False, c_sort: bool = False) MulticastRoutingTables
Parameters:
  • ordered – Flag to say if the results can be order dependent

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

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

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

Returns:

Compressed routing tables

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

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

Returns:

Compressed routing tables