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]¶
- 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:
- 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 (AbstractMulticastRoutingTable)
length (int)
- Returns:
mapping from codified route to routing entry
- Return type:
- 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:
o_route (MulticastRoutingEntry) – the original route
compressed_dict (dict(str, MulticastRoutingEntry)) – Compressed routes
o_code (str) – Codified original route (if known)
start (int) – Starting index in compressed routes
f (FileIO) – Where to write (part of) the route report
- pacman.operations.router_compressors.routing_compression_checker.compare_tables(original: AbstractMulticastRoutingTable, compressed: AbstractMulticastRoutingTable)[source]¶
Compares the two tables without generating any output.
- Parameters:
original (UnCompressedMulticastRoutingTable) – The original routing tables
compressed (CompressedMulticastRoutingTable) – 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.
- compress_all_tables() MulticastRoutingTables [source]¶
Apply compression to all uncompressed tables.
- Return type:
- 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:
router_tables (MulticastRoutingTables) – Routing tables
progress (ProgressBar) – Progress bar to show while working
- Returns:
The compressed but still unordered routing tables
- Return type:
- 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:
- pacman.operations.router_compressors.pair_compressor(ordered: bool = True, accept_overflow: bool = False, verify: bool = False, c_sort=False)¶
- Parameters:
- Return type:
- 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: