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

SpiNNakerManchester / sPyNNaker / 7015884430

28 Nov 2023 08:09AM UTC coverage: 63.082% (-0.07%) from 63.152%
7015884430

push

github

web-flow
Merge pull request #1345 from SpiNNakerManchester/interdimensional_compatibility

Interdimensional compatibility

1910 of 4427 branches covered (0.0%)

Branch coverage included in aggregate %.

206 of 532 new or added lines in 39 files covered. (38.72%)

69 existing lines in 22 files now uncovered.

12665 of 18678 relevant lines covered (67.81%)

0.68 hits per line

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

31.67
/spynnaker/pyNN/models/spike_source/spike_source_array_machine_vertex.py
1
# Copyright (c) 2022 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 __future__ import annotations
1✔
15
from typing import cast, TYPE_CHECKING
1✔
16
from spinn_utilities.overrides import overrides
1✔
17
from pacman.utilities.utility_calls import get_keys
1✔
18
from spinn_front_end_common.utility_models import (
1✔
19
    ReverseIPTagMulticastSourceMachineVertex)
20
from spynnaker.pyNN.data.spynnaker_data_view import SpynnakerDataView
1✔
21
if TYPE_CHECKING:
22
    from .spike_source_array_vertex import SpikeSourceArrayVertex
23

24

25
class SpikeSourceArrayMachineVertex(ReverseIPTagMulticastSourceMachineVertex):
1✔
26
    """
27
    Extended to add colour.
28
    """
29

30
    @property
1✔
31
    def _pop_vertex(self) -> SpikeSourceArrayVertex:
1✔
32
        return cast('SpikeSourceArrayVertex', self.app_vertex)
1✔
33

34
    @overrides(
1✔
35
        ReverseIPTagMulticastSourceMachineVertex.get_n_keys_for_partition)
36
    def get_n_keys_for_partition(self, partition_id: str) -> int:
1✔
37
        n_keys = super().get_n_keys_for_partition(partition_id)
1✔
38
        n_colours = 2 ** self._pop_vertex.n_colour_bits
1✔
39
        return n_keys * n_colours
1✔
40

41
    @overrides(ReverseIPTagMulticastSourceMachineVertex._fill_send_buffer_1d)
1✔
42
    def _fill_send_buffer_1d(self, key_base: int):
1✔
43
        first_time_step = SpynnakerDataView.get_first_machine_time_step()
×
44
        end_time_step = SpynnakerDataView.get_current_run_timesteps()
×
45
        if first_time_step == end_time_step:
×
46
            return
×
47
        if self._send_buffer_times is None or self._send_buffer is None:
×
48
            return
×
NEW
49
        keys = get_keys(
×
50
            key_base, self.vertex_slice, self._pop_vertex.n_colour_bits)
51
        colour_mask = (2 ** self._pop_vertex.n_colour_bits) - 1
×
UNCOV
52
        for tick in sorted(self._send_buffer_times):
×
53
            if self._is_in_range(tick, first_time_step, end_time_step):
×
54
                self._send_buffer.add_keys(
×
55
                    tick, keys + (tick & colour_mask))
56

57
    @overrides(ReverseIPTagMulticastSourceMachineVertex._fill_send_buffer_2d)
1✔
58
    def _fill_send_buffer_2d(self, key_base: int):
1✔
59
        first_time_step = SpynnakerDataView.get_first_machine_time_step()
×
60
        end_time_step = SpynnakerDataView.get_current_run_timesteps()
×
61
        if first_time_step == end_time_step:
×
62
            return
×
63
        if self._send_buffer_times is None or self._send_buffer is None:
×
64
            return
×
NEW
65
        keys = get_keys(
×
66
            key_base, self.vertex_slice, self._pop_vertex.n_colour_bits)
67
        colour_mask = (2 ** self._pop_vertex.n_colour_bits) - 1
×
68
        for atom in range(self.vertex_slice.n_atoms):
×
69
            for tick in sorted(self._send_buffer_times[atom]):
×
70
                if self._is_in_range(tick, first_time_step, end_time_step):
×
71
                    self._send_buffer.add_key(
×
72
                        tick, keys[atom] + (tick & colour_mask))
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