From 362a14916f9a1d74d1f411c55837232217b6fdd9 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 16 Jul 2024 15:17:42 +0100 Subject: [PATCH 1/3] raise too many incoming projections --- .../neuron/abstract_population_vertex.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py index ce7bee79ca..85cbe28149 100644 --- a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py +++ b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py @@ -57,7 +57,8 @@ BYTES_PER_WORD, SYSTEM_BYTES_REQUIREMENT) from spynnaker.pyNN.data import SpynnakerDataView -from spynnaker.pyNN.exceptions import SpynnakerException +from spynnaker.pyNN.exceptions import ( + SynapticConfigurationException, SpynnakerException) from spynnaker.pyNN.models.abstract_models import ( AbstractAcceptsIncomingSynapses, AbstractMaxSpikes, HasSynapses, @@ -1320,9 +1321,19 @@ def __add_matrix_size(self, address: int, projection: Projection, if max_row_info.undelayed_max_n_synapses > 0: size = n_sub_atoms * max_row_info.undelayed_max_bytes for _ in range(n_sub_edges): - address = \ - MasterPopTableAsBinarySearch.get_next_allowed_address( - address) + try: + address = \ + MasterPopTableAsBinarySearch.get_next_allowed_address( + address) + except SynapticConfigurationException as ex: + n_projections = (sum(len(x) + for x in self.__incoming_projections.values())) + if n_projections > 100: + raise SpynnakerException( + f"{self} has {n_projections} incoming Projections " + f"which is more than Spynnaker can handle.")\ + from ex + raise address += size if max_row_info.delayed_max_n_synapses > 0: size = (n_sub_atoms * max_row_info.delayed_max_bytes * From 9154d9f1a6b32d48f863bb5870309d2000620eae Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 16 Jul 2024 15:32:17 +0100 Subject: [PATCH 2/3] flake8 --- spynnaker/pyNN/models/neuron/abstract_population_vertex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py index 85cbe28149..33fc6b3fec 100644 --- a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py +++ b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py @@ -1327,7 +1327,7 @@ def __add_matrix_size(self, address: int, projection: Projection, address) except SynapticConfigurationException as ex: n_projections = (sum(len(x) - for x in self.__incoming_projections.values())) + for x in self.__incoming_projections.values())) if n_projections > 100: raise SpynnakerException( f"{self} has {n_projections} incoming Projections " From cdbb4d35b3ed7d973d04cfc84ee091fcb2924d90 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 16 Jul 2024 15:40:32 +0100 Subject: [PATCH 3/3] values varible for flake8 --- spynnaker/pyNN/models/neuron/abstract_population_vertex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py index 33fc6b3fec..21823adecb 100644 --- a/spynnaker/pyNN/models/neuron/abstract_population_vertex.py +++ b/spynnaker/pyNN/models/neuron/abstract_population_vertex.py @@ -1326,8 +1326,8 @@ def __add_matrix_size(self, address: int, projection: Projection, MasterPopTableAsBinarySearch.get_next_allowed_address( address) except SynapticConfigurationException as ex: - n_projections = (sum(len(x) - for x in self.__incoming_projections.values())) + values = self.__incoming_projections.values() + n_projections = (sum(len(x) for x in values)) if n_projections > 100: raise SpynnakerException( f"{self} has {n_projections} incoming Projections "