• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / PACMAN / 6945509033

21 Nov 2023 02:51PM UTC coverage: 84.047% (+0.9%) from 83.103%
6945509033

push

github

Christian-B
remove unused import

1552 of 2025 branches covered (0.0%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

534 existing lines in 55 files now uncovered.

5065 of 5848 relevant lines covered (86.61%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/pacman/operations/routing_table_generators/basic_routing_table_generator.py
1
# Copyright (c) 2016 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
from typing import Dict, Tuple
1✔
15
from spinn_utilities.progress_bar import ProgressBar
1✔
16
from spinn_machine import MulticastRoutingEntry
1✔
17
from pacman.data import PacmanDataView
1✔
18
from pacman.model.routing_tables import (
1✔
19
    UnCompressedMulticastRoutingTable, MulticastRoutingTables)
20
from pacman.model.graphs import AbstractVertex
1✔
21
from pacman.model.routing_table_by_partition import (
1✔
22
    MulticastRoutingTableByPartitionEntry)
23
from pacman.model.routing_info import RoutingInfo
1✔
24

25

26
def basic_routing_table_generator() -> MulticastRoutingTables:
1✔
27
    """
28
    An basic algorithm that can produce routing tables.
29

30
    :rtype: MulticastRoutingTables
31
    """
32
    routing_infos = PacmanDataView.get_routing_infos()
1✔
33
    routing_table_by_partitions = (
1✔
34
        PacmanDataView.get_routing_table_by_partition())
35
    progress = ProgressBar(
1✔
36
        routing_table_by_partitions.n_routers, "Generating routing tables")
37
    routing_tables = MulticastRoutingTables()
1✔
38
    for x, y in progress.over(routing_table_by_partitions.get_routers()):
1✔
39
        parts = routing_table_by_partitions.get_entries_for_router(x, y)
1✔
40
        # Should be there; skip if not
41
        if parts is None:
1!
UNCOV
42
            continue
×
43
        routing_tables.add_routing_table(__create_routing_table(
1✔
44
            x, y, parts, routing_infos))
45

46
    return routing_tables
1✔
47

48

49
def __create_routing_table(
1✔
50
        x: int, y: int, partitions_in_table: Dict[
51
            Tuple[AbstractVertex, str], MulticastRoutingTableByPartitionEntry],
52
        routing_infos: RoutingInfo):
53
    """
54
    :param int x:
55
    :param int y:
56
    :param partitions_in_table:
57
    :type partitions_in_table:
58
        dict(((ApplicationVertex or MachineVertex), str),
59
        MulticastRoutingTableByPartitionEntry)
60
    :param RoutingInfo routing_infos:
61
    :rtype: MulticastRoutingTable
62
    """
63
    table = UnCompressedMulticastRoutingTable(x, y)
1✔
64
    for source_vertex, partition_id in partitions_in_table:
1✔
65
        r_info = routing_infos.get_routing_info_from_pre_vertex(
1✔
66
            source_vertex, partition_id)
67
        # Should be there; skip if not
68
        if r_info is None:
1!
UNCOV
69
            continue
×
70
        entry = partitions_in_table[source_vertex, partition_id]
1✔
71
        table.add_multicast_routing_entry(MulticastRoutingEntry(
1✔
72
            routing_entry_key=r_info.key_and_mask.key_combo,
73
            defaultable=entry.defaultable, mask=r_info.key_and_mask.mask,
74
            link_ids=entry.link_ids, processor_ids=entry.processor_ids))
75

76
    return table
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc