Skip to content

Commit b1fd59b

Browse files
authored
Merge pull request #1661 from SpiNNakerManchester/validate_routes_uncompressed
cache the index used to make call repeatable
2 parents fe8743b + 0f217d3 commit b1fd59b

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

spynnaker/pyNN/extra_algorithms/splitter_components/splitter_population_vertex_neurons_synapses.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ class SplitterPopulationVertexNeuronsSynapses(
102102
"__sdram_partitions",
103103
# The same chip groups
104104
"__same_chip_groups",
105+
# The index used in get_source_specific_in_coming_vertices
106+
"__synapse_index_used",
105107
# The application vertex sources that are neuromodulators
106108
"__neuromodulators")
107109

@@ -117,6 +119,9 @@ def __init__(self) -> None:
117119
SourceSegmentedSDRAMMachinePartition] = []
118120
self.__same_chip_groups: List[Tuple[
119121
List[MachineVertex], AbstractSDRAM]] = []
122+
self.__synapse_index_used: Dict[Tuple[ApplicationVertex, str], int]
123+
self.__synapse_index_used = dict()
124+
120125
self.__neuromodulators: Set[ApplicationVertex] = set()
121126
self.__incoming_vertices: List[List[MachineVertex]] = []
122127
self.__poisson_sources: Set[SpikeSourcePoissonVertex] = set()
@@ -539,10 +544,16 @@ def get_source_specific_in_coming_vertices(
539544
sources_per_vertex = max(1, int(2 ** math.ceil(math.log2(
540545
n_sources / n_synapse_cores))))
541546

542-
# Start on a different index each time to "even things out"
543-
index = self.__next_synapse_index
544-
self.__next_synapse_index = (
545-
(self.__next_synapse_index + 1) % n_synapse_cores)
547+
key = (source_vertex, partition_id)
548+
if key in self.__synapse_index_used:
549+
index = self.__synapse_index_used[key]
550+
else:
551+
# Start on a different index each time to "even things out"
552+
index = self.__next_synapse_index
553+
self.__next_synapse_index = (
554+
(self.__next_synapse_index + 1) % n_synapse_cores)
555+
self.__synapse_index_used[key] = index
556+
546557
result: List[Tuple[MachineVertex, List[MachineVertex]]] = list()
547558
for start in range(0, n_sources, sources_per_vertex):
548559
end = min(start + sources_per_vertex, n_sources)

0 commit comments

Comments
 (0)