From 7bb823be0d5d9ba4d36804e49be478ef1e9a6451 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 10:57:36 +0100 Subject: [PATCH 01/47] move external_devices --- spynnaker/pyNN/external_devices/__init__.py | 301 ++++++++++++++++++++ spynnaker/pyNN/utilities/utility_calls.py | 2 +- spynnaker8/external_devices/__init__.py | 4 + spynnaker8/utilities/neo_convertor.py | 3 + 4 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 spynnaker/pyNN/external_devices/__init__.py diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py new file mode 100644 index 0000000000..3aecacdaa0 --- /dev/null +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -0,0 +1,301 @@ +# Copyright (c) 2017-2019 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +This contains functions and classes for handling external devices such as the +PushBot (http://spinnakermanchester.github.io/docs/push_bot/). + +.. note:: + When using external devices, it is normally important to configure your + SpiNNaker system to run in real-time mode, which usually reduces numerical + accuracy to gain performance. +""" +import os +from spinn_utilities.socket_address import SocketAddress +from spinnman.messages.eieio import EIEIOType +from spinn_front_end_common.abstract_models import ( + AbstractSendMeMulticastCommandsVertex) +from spinn_front_end_common.utilities.globals_variables import get_simulator +from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon +from spynnaker.pyNN.external_devices_models import ( + AbstractEthernetController, AbstractEthernetSensor, + ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, + MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) +from spynnaker.pyNN.models.utility_models.spike_injector import ( + SpikeInjector as + ExternalDeviceSpikeInjector) +from spynnaker.pyNN import model_binaries +from spynnaker.pyNN.connections import ( + EthernetCommandConnection, EthernetControlConnection, + SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) +from spynnaker.pyNN.external_devices_models.push_bot.control import ( + PushBotLifEthernet, PushBotLifSpinnakerLink) +from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( + PushBotSpiNNakerLinkRetinaDevice, + PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, + PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( + PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, + PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, + PushBotEthernetSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( + PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, + PushBotSpeaker, PushBotRetinaViewer) +from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol +from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( + SpynnakerExternalDevicePluginManager as + Plugins) +from spynnaker.pyNN.models.populations import Population + +# useful functions +add_database_socket_address = Plugins.add_database_socket_address +activate_live_output_to = Plugins.activate_live_output_to +activate_live_output_for = Plugins.activate_live_output_for +add_poisson_live_rate_control = Plugins.add_poisson_live_rate_control + +AbstractSpiNNakerCommon.register_binary_search_path( + os.path.dirname(model_binaries.__file__)) +spynnaker_external_devices = Plugins() + +__all__ = [ + "EIEIOType", + + # General Devices + "ExternalCochleaDevice", "ExternalFPGARetinaDevice", + "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", + "PushBotRetinaViewer", "ExternalDeviceLifControl", + + # PushBot Parameters + "MunichIoSpiNNakerLinkProtocol", + "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", + "PushBotRetinaResolution", + + # PushBot Ethernet Parts + "PushBotLifEthernet", "PushBotEthernetLaserDevice", + "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", + "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", + + # PushBot SpiNNaker Link Parts + "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", + "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", + "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", + + # Connections + "SpynnakerLiveSpikesConnection", + "SpynnakerPoissonControlConnection", + + # Provided functions + "activate_live_output_for", + "activate_live_output_to", + "SpikeInjector", + "register_database_notification_request", + "run_forever", + "add_poisson_live_rate_control" +] + + +def run_forever(sync_time=0): + """ Supports running forever in PyNN 0.8/0.9 format + + :param sync_time: + The time in milliseconds after which to pause before the host must + continue the simulation + :return: when the application has started running on the SpiNNaker platform + """ + get_simulator().run(None, sync_time) + + +def run_sync(run_time, sync_time): + """ Run in steps of the given number of milliseconds pausing between\ + for a signal to be sent from the host + + :param float run_time: The time in milliseconds to run the simulation for + :param float sync_time: The time in milliseconds to pause before allowing + """ + get_simulator().run(run_time, sync_time) + + +def continue_simulation(): + """ Continue a synchronised simulation + """ + get_simulator().continue_simulation() + + +def request_stop(): + """ Request a stop in the simulation without a complete stop. Will stop\ + after the next auto-pause-and-resume cycle + """ + get_simulator().stop_run() + + +def register_database_notification_request(hostname, notify_port, ack_port): + """ Adds a socket system which is registered with the notification protocol + + :param str hostname: hostname to connect to + :param int notify_port: port num for the notify command + :param int ack_port: port num for the acknowledge command + """ + spynnaker_external_devices.add_socket_address( + SocketAddress(hostname, notify_port, ack_port)) + + +# Store the connection to be used by multiple users +__ethernet_control_connection = None + + +def EthernetControlPopulation( + n_neurons, model, label=None, local_host=None, local_port=None, + database_notify_port_num=None, database_ack_port_num=None): + """ Create a PyNN population that can be included in a network to\ + control an external device which is connected to the host + + :param int n_neurons: The number of neurons in the control population + :param type model: + Class of a model that creates a vertex of type + :py:class:`AbstractEthernetController` + :param label: An optional label for the population + :type label: str or None + :param local_host: + The optional local host IP address to listen on for commands + :type local_host: str or None + :param local_port: The optional local port to listen on for commands + :type local_port: int or None + :param database_ack_port_num: + The optional port to which responses to the database notification + protocol are to be sent + :type database_ack_port_num: int or None + :param database_notify_port_num: + The optional port to which notifications from the database + notification protocol are to be sent + :type database_notify_port_num: int or None + :return: + A pyNN Population which can be used as the target of a Projection. + Note that the Population can also be used as the source of a + Projection, but it might not send spikes. + :rtype: ~spynnaker.pyNN.models.populations.Population + :raises Exception: If an invalid model class is used. + """ + # pylint: disable=protected-access, too-many-arguments, too-many-locals + population = Population(n_neurons, model, label=label) + vertex = population._vertex + if not isinstance(vertex, AbstractEthernetController): + raise Exception( + "Vertex must be an instance of AbstractEthernetController") + translator = vertex.get_message_translator() + live_packet_gather_label = "EthernetControlReceiver" + global __ethernet_control_connection + if __ethernet_control_connection is None: + __ethernet_control_connection = EthernetControlConnection( + translator, vertex.label, live_packet_gather_label, local_host, + local_port) + Plugins.add_database_socket_address( + __ethernet_control_connection.local_ip_address, + __ethernet_control_connection.local_port, database_ack_port_num) + else: + __ethernet_control_connection.add_translator(vertex.label, translator) + devices_with_commands = [ + device for device in vertex.get_external_devices() + if isinstance(device, AbstractSendMeMulticastCommandsVertex)] + if devices_with_commands: + ethernet_command_connection = EthernetCommandConnection( + translator, devices_with_commands, local_host, + database_notify_port_num) + Plugins.add_database_socket_address( + ethernet_command_connection.local_ip_address, + ethernet_command_connection.local_port, database_ack_port_num) + Plugins.update_live_packet_gather_tracker( + vertex, live_packet_gather_label, + port=__ethernet_control_connection.local_port, + hostname=__ethernet_control_connection.local_ip_address, + message_type=EIEIOType.KEY_PAYLOAD_32_BIT, + payload_as_time_stamps=False, use_payload_prefix=False, + partition_ids=vertex.get_outgoing_partition_ids()) + return population + + +def EthernetSensorPopulation( + device, local_host=None, + database_notify_port_num=None, database_ack_port_num=None): + """ Create a pyNN population which can be included in a network to\ + receive spikes from a device connected to the host + + :param AbstractEthernetSensor device: The sensor model + :param local_host: + The optional local host IP address to listen on for database + notification + :type local_host: str or None + :param database_ack_port_num: + The optional port to which responses to the database notification + protocol are to be sent + :type database_ack_port_num: int or None + :param database_notify_port_num: + The optional port to which notifications from the database + notification protocol are to be sent + :type database_notify_port_num: int or None + :return: + A pyNN Population which can be used as the source of a Projection. + Note that the Population cannot be used as the target of a Projection. + :rtype: ~spynnaker.pyNN.models.populations.Population + """ + if not isinstance(device, AbstractEthernetSensor): + raise Exception("Device must be an instance of AbstractEthernetSensor") + injector_params = dict(device.get_injector_parameters()) + + population = Population( + device.get_n_neurons(), SpikeInjector(notify=False), + label=device.get_injector_label(), + additional_parameters=injector_params) + if isinstance(device, AbstractSendMeMulticastCommandsVertex): + cmd_conn = EthernetCommandConnection( + device.get_translator(), [device], local_host, + database_notify_port_num) + Plugins.add_database_socket_address( + cmd_conn.local_ip_address, cmd_conn.local_port, + database_ack_port_num) + db_conn = device.get_database_connection() + if db_conn is not None: + Plugins.add_database_socket_address( + db_conn.local_ip_address, db_conn.local_port, + database_ack_port_num) + return population + + +def SpikeInjector( + notify=True, database_notify_host=None, database_notify_port_num=None, + database_ack_port_num=None): + """ Supports creating a spike injector that can be added to the\ + application graph. + + :param bool notify: Whether to register for notifications + :param database_notify_host: the hostname for the device which is + listening to the database notification. + :type database_notify_host: str or None + :param database_ack_port_num: the port number to which a external device + will acknowledge that they have finished reading the database and are + ready for it to start execution + :type database_ack_port_num: int or None + :param database_notify_port_num: The port number to which a external + device will receive the database is ready command + :type database_notify_port_num: int or None + :return: The spike injector model object that can be placed in a pyNN + :py:class:`~spynnaker.pyNN.models.populations.Population`. + :rtype: ~spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel + """ + # pylint: disable=too-many-arguments + if notify: + Plugins.add_database_socket_address( + database_notify_host, database_notify_port_num, + database_ack_port_num) + return ExternalDeviceSpikeInjector() diff --git a/spynnaker/pyNN/utilities/utility_calls.py b/spynnaker/pyNN/utilities/utility_calls.py index e5bdf534df..c169ea5ab5 100644 --- a/spynnaker/pyNN/utilities/utility_calls.py +++ b/spynnaker/pyNN/utilities/utility_calls.py @@ -348,7 +348,7 @@ def moved_in_v6(old_location, new_location): """ Warns the users that they are using an old import. - In version 7 this will ne upgraded to a exception and then later removed + In version 7 this will be upgraded to a exception and then later removed :param str old_location: old import :param str new_location: new import diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 3aecacdaa0..29ca065788 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -58,6 +58,10 @@ SpynnakerExternalDevicePluginManager as Plugins) from spynnaker.pyNN.models.populations import Population +from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 + + +moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") # useful functions add_database_socket_address = Plugins.add_database_socket_address diff --git a/spynnaker8/utilities/neo_convertor.py b/spynnaker8/utilities/neo_convertor.py index 8bf749519e..59d7b99330 100644 --- a/spynnaker8/utilities/neo_convertor.py +++ b/spynnaker8/utilities/neo_convertor.py @@ -221,4 +221,7 @@ def count_spikes(neo): :param ~neo.core.Block neo: Neo Object which has spikes in it :return: The number of spikes in the first segment """ + moved_in_v6( + "spynnaker8.utilities.neo_convertor", + "spynnaker.pyNN.utilities.neo_convertor") return count_spiketrains(neo.segments[0].spiketrains) From 0959dd65baf2fc4cb1f24463b5bacf9b48bc7082 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 11:09:20 +0100 Subject: [PATCH 02/47] replace spynnaker8 import --- .../test_external_devices/test_multiboard_spike_output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py index 815695d3e9..ffa988e6c0 100644 --- a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py +++ b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py @@ -17,7 +17,7 @@ from unittest import SkipTest from spynnaker.pyNN.exceptions import ConfigurationException import spynnaker8 as p -import spynnaker8.external_devices as e +import spynnaker.pyNN.external_devices as e from spinnaker_testbase import BaseTestCase From 0b736798aa2d6412633ad19ab5dfd3a4dcdb564f Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 11:52:56 +0100 Subject: [PATCH 03/47] move code to spynnaker.pyNN --- spynnaker8/external_devices/__init__.py | 221 +++++++----------------- 1 file changed, 62 insertions(+), 159 deletions(-) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 29ca065788..ea75aac186 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -22,23 +22,11 @@ SpiNNaker system to run in real-time mode, which usually reduces numerical accuracy to gain performance. """ -import os -from spinn_utilities.socket_address import SocketAddress from spinnman.messages.eieio import EIEIOType -from spinn_front_end_common.abstract_models import ( - AbstractSendMeMulticastCommandsVertex) -from spinn_front_end_common.utilities.globals_variables import get_simulator -from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon from spynnaker.pyNN.external_devices_models import ( - AbstractEthernetController, AbstractEthernetSensor, ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) -from spynnaker.pyNN.models.utility_models.spike_injector import ( - SpikeInjector as - ExternalDeviceSpikeInjector) -from spynnaker.pyNN import model_binaries from spynnaker.pyNN.connections import ( - EthernetCommandConnection, EthernetControlConnection, SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) from spynnaker.pyNN.external_devices_models.push_bot.control import ( PushBotLifEthernet, PushBotLifSpinnakerLink) @@ -54,24 +42,15 @@ PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, PushBotSpeaker, PushBotRetinaViewer) from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol -from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( - SpynnakerExternalDevicePluginManager as - Plugins) -from spynnaker.pyNN.models.populations import Population from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 - -moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") +import spynnaker.pyNN.external_devices as moved_code # useful functions -add_database_socket_address = Plugins.add_database_socket_address -activate_live_output_to = Plugins.activate_live_output_to -activate_live_output_for = Plugins.activate_live_output_for -add_poisson_live_rate_control = Plugins.add_poisson_live_rate_control - -AbstractSpiNNakerCommon.register_binary_search_path( - os.path.dirname(model_binaries.__file__)) -spynnaker_external_devices = Plugins() +add_database_socket_address = moved_code.add_database_socket_address +activate_live_output_to = moved_code.activate_live_output_to +activate_live_output_for = moved_code.activate_live_output_for +add_poisson_live_rate_control = moved_code.add_poisson_live_rate_control __all__ = [ "EIEIOType", @@ -113,46 +92,65 @@ def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format - :param sync_time: - The time in milliseconds after which to pause before the host must - continue the simulation - :return: when the application has started running on the SpiNNaker platform + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.run_forever` instead. """ - get_simulator().run(None, sync_time) + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.run_forever(sync_time) def run_sync(run_time, sync_time): """ Run in steps of the given number of milliseconds pausing between\ for a signal to be sent from the host - :param float run_time: The time in milliseconds to run the simulation for - :param float sync_time: The time in milliseconds to pause before allowing + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.run_sync` instead. """ - get_simulator().run(run_time, sync_time) + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.run_sync(run_time, sync_time) def continue_simulation(): """ Continue a synchronised simulation + + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.continue_simulation` instead. """ - get_simulator().continue_simulation() + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.continue_simulation() def request_stop(): """ Request a stop in the simulation without a complete stop. Will stop\ after the next auto-pause-and-resume cycle + + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.request_stop` instead. """ - get_simulator().stop_run() + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.request_stop() def register_database_notification_request(hostname, notify_port, ack_port): """ Adds a socket system which is registered with the notification protocol - :param str hostname: hostname to connect to - :param int notify_port: port num for the notify command - :param int ack_port: port num for the acknowledge command + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.register_database_notification_request` + instead. """ - spynnaker_external_devices.add_socket_address( - SocketAddress(hostname, notify_port, ack_port)) + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.register_database_notification_request( + hostname, notify_port, ack_port) # Store the connection to be used by multiple users @@ -165,68 +163,15 @@ def EthernetControlPopulation( """ Create a PyNN population that can be included in a network to\ control an external device which is connected to the host - :param int n_neurons: The number of neurons in the control population - :param type model: - Class of a model that creates a vertex of type - :py:class:`AbstractEthernetController` - :param label: An optional label for the population - :type label: str or None - :param local_host: - The optional local host IP address to listen on for commands - :type local_host: str or None - :param local_port: The optional local port to listen on for commands - :type local_port: int or None - :param database_ack_port_num: - The optional port to which responses to the database notification - protocol are to be sent - :type database_ack_port_num: int or None - :param database_notify_port_num: - The optional port to which notifications from the database - notification protocol are to be sent - :type database_notify_port_num: int or None - :return: - A pyNN Population which can be used as the target of a Projection. - Note that the Population can also be used as the source of a - Projection, but it might not send spikes. - :rtype: ~spynnaker.pyNN.models.populations.Population - :raises Exception: If an invalid model class is used. + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.EthernetControlPopulation` instead. """ - # pylint: disable=protected-access, too-many-arguments, too-many-locals - population = Population(n_neurons, model, label=label) - vertex = population._vertex - if not isinstance(vertex, AbstractEthernetController): - raise Exception( - "Vertex must be an instance of AbstractEthernetController") - translator = vertex.get_message_translator() - live_packet_gather_label = "EthernetControlReceiver" - global __ethernet_control_connection - if __ethernet_control_connection is None: - __ethernet_control_connection = EthernetControlConnection( - translator, vertex.label, live_packet_gather_label, local_host, - local_port) - Plugins.add_database_socket_address( - __ethernet_control_connection.local_ip_address, - __ethernet_control_connection.local_port, database_ack_port_num) - else: - __ethernet_control_connection.add_translator(vertex.label, translator) - devices_with_commands = [ - device for device in vertex.get_external_devices() - if isinstance(device, AbstractSendMeMulticastCommandsVertex)] - if devices_with_commands: - ethernet_command_connection = EthernetCommandConnection( - translator, devices_with_commands, local_host, - database_notify_port_num) - Plugins.add_database_socket_address( - ethernet_command_connection.local_ip_address, - ethernet_command_connection.local_port, database_ack_port_num) - Plugins.update_live_packet_gather_tracker( - vertex, live_packet_gather_label, - port=__ethernet_control_connection.local_port, - hostname=__ethernet_control_connection.local_ip_address, - message_type=EIEIOType.KEY_PAYLOAD_32_BIT, - payload_as_time_stamps=False, use_payload_prefix=False, - partition_ids=vertex.get_outgoing_partition_ids()) - return population + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.EthernetControlPopulation( + n_neurons, model, label, local_host, local_port, + database_notify_port_num, database_ack_port_num) def EthernetSensorPopulation( @@ -235,45 +180,14 @@ def EthernetSensorPopulation( """ Create a pyNN population which can be included in a network to\ receive spikes from a device connected to the host - :param AbstractEthernetSensor device: The sensor model - :param local_host: - The optional local host IP address to listen on for database - notification - :type local_host: str or None - :param database_ack_port_num: - The optional port to which responses to the database notification - protocol are to be sent - :type database_ack_port_num: int or None - :param database_notify_port_num: - The optional port to which notifications from the database - notification protocol are to be sent - :type database_notify_port_num: int or None - :return: - A pyNN Population which can be used as the source of a Projection. - Note that the Population cannot be used as the target of a Projection. - :rtype: ~spynnaker.pyNN.models.populations.Population + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.EthernetSensorPopulation` instead. """ - if not isinstance(device, AbstractEthernetSensor): - raise Exception("Device must be an instance of AbstractEthernetSensor") - injector_params = dict(device.get_injector_parameters()) - - population = Population( - device.get_n_neurons(), SpikeInjector(notify=False), - label=device.get_injector_label(), - additional_parameters=injector_params) - if isinstance(device, AbstractSendMeMulticastCommandsVertex): - cmd_conn = EthernetCommandConnection( - device.get_translator(), [device], local_host, - database_notify_port_num) - Plugins.add_database_socket_address( - cmd_conn.local_ip_address, cmd_conn.local_port, - database_ack_port_num) - db_conn = device.get_database_connection() - if db_conn is not None: - Plugins.add_database_socket_address( - db_conn.local_ip_address, db_conn.local_port, - database_ack_port_num) - return population + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.EthernetSensorPopulation( + device, local_host, database_notify_port_num, database_ack_port_num) def SpikeInjector( @@ -282,24 +196,13 @@ def SpikeInjector( """ Supports creating a spike injector that can be added to the\ application graph. - :param bool notify: Whether to register for notifications - :param database_notify_host: the hostname for the device which is - listening to the database notification. - :type database_notify_host: str or None - :param database_ack_port_num: the port number to which a external device - will acknowledge that they have finished reading the database and are - ready for it to start execution - :type database_ack_port_num: int or None - :param database_notify_port_num: The port number to which a external - device will receive the database is ready command - :type database_notify_port_num: int or None - :return: The spike injector model object that can be placed in a pyNN - :py:class:`~spynnaker.pyNN.models.populations.Population`. - :rtype: ~spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel + .. deprecated:: 6.0 + Use + :py:method:`spynnaker.pyNN.external_devices.SpikeInjector` instead. """ # pylint: disable=too-many-arguments - if notify: - Plugins.add_database_socket_address( - database_notify_host, database_notify_port_num, - database_ack_port_num) - return ExternalDeviceSpikeInjector() + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.SpikeInjector( + notify, database_notify_host, database_notify_port_num, + database_ack_port_num) From 9e5c54f34093fdb8857bd7230b3e246c1b6ee946 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 11:53:49 +0100 Subject: [PATCH 04/47] move SpiNNaker to spynnaker.pyNN --- spynnaker/pyNN/spinnaker.py | 277 ++++++++++++++++++++++++++++++++++++ spynnaker8/__init__.py | 2 +- spynnaker8/spinnaker.py | 264 ++-------------------------------- 3 files changed, 290 insertions(+), 253 deletions(-) create mode 100644 spynnaker/pyNN/spinnaker.py diff --git a/spynnaker/pyNN/spinnaker.py b/spynnaker/pyNN/spinnaker.py new file mode 100644 index 0000000000..bb9d69a15f --- /dev/null +++ b/spynnaker/pyNN/spinnaker.py @@ -0,0 +1,277 @@ +# Copyright (c) 2017-2019 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from lazyarray import __version__ as lazyarray_version +from quantities import __version__ as quantities_version +from neo import __version__ as neo_version +from pyNN.common import control as pynn_control +from pyNN import __version__ as pynn_version +from spinn_front_end_common.utilities.constants import ( + MICRO_TO_MILLISECOND_CONVERSION) +from spinn_front_end_common.interface.abstract_spinnaker_base import ( + AbstractSpinnakerBase) +from spinn_front_end_common.interface.provenance import ProvenanceWriter +from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon +from spynnaker import _version + +_NAME = "SpiNNaker_under_version({}-{})".format( + _version.__version__, _version.__version_name__) + + +class SpiNNaker(AbstractSpiNNakerCommon, pynn_control.BaseState): + """ Main interface for the sPyNNaker implementation of PyNN 0.8/0.9 + """ + + def __init__( + self, database_socket_addresses, + time_scale_factor, min_delay, graph_label, + n_chips_required=None, n_boards_required=None, timestep=0.1): + # pylint: disable=too-many-arguments, too-many-locals + + # change min delay auto to be the min delay supported by simulator + if min_delay == "auto": + min_delay = timestep + + # population and projection holders + self._populations = list() + self._projections = list() + + # pynn demanded objects + self.__segment_counter = 0 + self.__recorders = set([]) + + # main pynn interface inheritance + pynn_control.BaseState.__init__(self) + + # SpiNNaker setup + super(SpiNNaker, self).__init__( + database_socket_addresses=database_socket_addresses, + graph_label=graph_label, n_chips_required=n_chips_required, + n_boards_required=n_boards_required, + min_delay=min_delay, + timestep=timestep, time_scale_factor=time_scale_factor) + + with ProvenanceWriter() as db: + db.insert_version("sPyNNaker_version", _version.__version__) + db.insert_version("pyNN_version", pynn_version) + db.insert_version("quantities_version", quantities_version) + db.insert_version("neo_version", neo_version) + db.insert_version("lazyarray_version", lazyarray_version) + + def run(self, run_time, sync_time=0.0): + """ Run the simulation for a span of simulation time. + + :param run_time: the time to run for, in milliseconds + :return: None + """ + + self._run_wait(run_time, sync_time) + + def run_until(self, tstop): + """ Run the simulation until the given simulation time. + + :param tstop: when to run until in milliseconds + """ + # Build data + self._run_wait(tstop - self.t) + + def clear(self): + """ Clear the current recordings and reset the simulation + """ + self.recorders = set([]) + self.id_counter = 0 + self.__segment_counter = -1 + self.reset() + + # Stop any currently running SpiNNaker application + self.stop() + + def reset(self): + """ Reset the state of the current network to time t = 0. + """ + for population in self._populations: + population._cache_data() + + self.__segment_counter += 1 + + # Call superclass implementation + AbstractSpinnakerBase.reset(self) + + def _run_wait(self, duration_ms, sync_time=0.0): + """ Run the simulation for a length of simulation time. + + :param duration_ms: The run duration, in milliseconds + :type duration_ms: int or float + """ + + super(SpiNNaker, self).run(duration_ms, sync_time) + + @property + def state(self): + """ Used to bypass the dual level object + + :return: the SpiNNaker object + :rtype: ~spynnaker8.spinnaker.SpiNNaker + """ + return self + + @property + def mpi_rank(self): + """ Gets the MPI rank of the simulator + + .. note:: + Meaningless on SpiNNaker, so we pretend we're the head node. + + :return: Constant: 0 + :rtype: int + """ + return 0 + + @mpi_rank.setter + def mpi_rank(self, new_value): + """ sPyNNaker does not use this value meaningfully + + :param new_value: Ignored + """ + + @property + def num_processes(self): + """ Gets the number of MPI worker processes + + .. note:: + Meaningless on SpiNNaker, so we pretend there's one MPI process + + :return: Constant: 1 + :rtype: int + """ + return 1 + + @num_processes.setter + def num_processes(self, new_value): + """ sPyNNaker does not use this value meaningfully + + :param new_value: Ignored + """ + + @property + def dt(self): + """ The machine time step in milliseconds + + :return: the machine time step + :rtype: float + """ + return self.machine_time_step_ms + + @dt.setter + def dt(self, new_value): + """ The machine time step in milliseconds + + :param float new_value: new value for machine time step in microseconds + """ + self.machine_time_step = new_value * MICRO_TO_MILLISECOND_CONVERSION + + @property + def t(self): + """ The current simulation time in milliseconds + + :return: the current runtime already executed + :rtype: float + """ + return self._current_run_timesteps * self.machine_time_step_ms + + @property + def segment_counter(self): + """ The number of the current recording segment being generated. + + :return: the segment counter + :rtype: int + """ + return self.__segment_counter + + @segment_counter.setter + def segment_counter(self, new_value): + """ The number of the current recording segment being generated. + + :param int new_value: new value for the segment counter + """ + self.__segment_counter = new_value + + @property + def running(self): + """ Whether the simulation is running or has run. + + .. note:: + Ties into our has_ran parameter for automatic pause and resume. + + :return: the has_ran variable from the SpiNNaker main interface + :rtype: bool + """ + return self._has_ran + + @running.setter + def running(self, new_value): + """ Setter for the has_ran parameter, only used by the PyNN interface,\ + supports tracking where it thinks its setting this parameter. + + :param bool new_value: the new value for the simulation + """ + self._has_ran = new_value + + @property + def name(self): + """ The name of the simulator. Used to ensure PyNN recording neo\ + blocks are correctly labelled. + + :return: the name of the simulator. + :rtype: str + """ + return _NAME + + @property + def populations(self): + """ The list of all populations in the simulation. + + :return: list of populations + :rtype: list(~spynnaker.pyNN.models.population.Population) + """ + # needed by the population class + return self._populations + + @property + def projections(self): + """ The list of all projections in the simulation. + + :return: list of projections + :rtype: list(~spynnaker.pyNN.models.projection.Projection) + """ + # needed by the projection class. + return self._projections + + @property + def recorders(self): + """ The recorders, used by the PyNN state object + + :return: the internal recorders object + :rtype: list(~spynnaker.pyNN.models.recorder.Recorder) + """ + return self.__recorders + + @recorders.setter + def recorders(self, new_value): + """ Setter for the internal recorders object + + :param new_value: the new value for the recorder + """ + self.__recorders = new_value diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index ac082264d5..3972153f8d 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -110,7 +110,7 @@ from spynnaker8 import extra_models # big stuff -from spynnaker8.spinnaker import SpiNNaker +from spynnaker.pyNN.spinnaker import SpiNNaker #: The timestep to use of "auto" is specified as a timestep SPYNNAKER_AUTO_TIMESTEP = 1.0 diff --git a/spynnaker8/spinnaker.py b/spynnaker8/spinnaker.py index bb9d69a15f..0c79a1f93f 100644 --- a/spynnaker8/spinnaker.py +++ b/spynnaker8/spinnaker.py @@ -13,25 +13,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from lazyarray import __version__ as lazyarray_version -from quantities import __version__ as quantities_version -from neo import __version__ as neo_version -from pyNN.common import control as pynn_control -from pyNN import __version__ as pynn_version -from spinn_front_end_common.utilities.constants import ( - MICRO_TO_MILLISECOND_CONVERSION) -from spinn_front_end_common.interface.abstract_spinnaker_base import ( - AbstractSpinnakerBase) -from spinn_front_end_common.interface.provenance import ProvenanceWriter -from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon -from spynnaker import _version +from spynnaker.pyNN.spinnaker import SpiNNaker as _BaseClass +from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 -_NAME = "SpiNNaker_under_version({}-{})".format( - _version.__version__, _version.__version_name__) - -class SpiNNaker(AbstractSpiNNakerCommon, pynn_control.BaseState): +class SpiNNaker(_BaseClass): """ Main interface for the sPyNNaker implementation of PyNN 0.8/0.9 + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.SpiNNaker` instead. """ def __init__( @@ -39,239 +30,8 @@ def __init__( time_scale_factor, min_delay, graph_label, n_chips_required=None, n_boards_required=None, timestep=0.1): # pylint: disable=too-many-arguments, too-many-locals - - # change min delay auto to be the min delay supported by simulator - if min_delay == "auto": - min_delay = timestep - - # population and projection holders - self._populations = list() - self._projections = list() - - # pynn demanded objects - self.__segment_counter = 0 - self.__recorders = set([]) - - # main pynn interface inheritance - pynn_control.BaseState.__init__(self) - - # SpiNNaker setup - super(SpiNNaker, self).__init__( - database_socket_addresses=database_socket_addresses, - graph_label=graph_label, n_chips_required=n_chips_required, - n_boards_required=n_boards_required, - min_delay=min_delay, - timestep=timestep, time_scale_factor=time_scale_factor) - - with ProvenanceWriter() as db: - db.insert_version("sPyNNaker_version", _version.__version__) - db.insert_version("pyNN_version", pynn_version) - db.insert_version("quantities_version", quantities_version) - db.insert_version("neo_version", neo_version) - db.insert_version("lazyarray_version", lazyarray_version) - - def run(self, run_time, sync_time=0.0): - """ Run the simulation for a span of simulation time. - - :param run_time: the time to run for, in milliseconds - :return: None - """ - - self._run_wait(run_time, sync_time) - - def run_until(self, tstop): - """ Run the simulation until the given simulation time. - - :param tstop: when to run until in milliseconds - """ - # Build data - self._run_wait(tstop - self.t) - - def clear(self): - """ Clear the current recordings and reset the simulation - """ - self.recorders = set([]) - self.id_counter = 0 - self.__segment_counter = -1 - self.reset() - - # Stop any currently running SpiNNaker application - self.stop() - - def reset(self): - """ Reset the state of the current network to time t = 0. - """ - for population in self._populations: - population._cache_data() - - self.__segment_counter += 1 - - # Call superclass implementation - AbstractSpinnakerBase.reset(self) - - def _run_wait(self, duration_ms, sync_time=0.0): - """ Run the simulation for a length of simulation time. - - :param duration_ms: The run duration, in milliseconds - :type duration_ms: int or float - """ - - super(SpiNNaker, self).run(duration_ms, sync_time) - - @property - def state(self): - """ Used to bypass the dual level object - - :return: the SpiNNaker object - :rtype: ~spynnaker8.spinnaker.SpiNNaker - """ - return self - - @property - def mpi_rank(self): - """ Gets the MPI rank of the simulator - - .. note:: - Meaningless on SpiNNaker, so we pretend we're the head node. - - :return: Constant: 0 - :rtype: int - """ - return 0 - - @mpi_rank.setter - def mpi_rank(self, new_value): - """ sPyNNaker does not use this value meaningfully - - :param new_value: Ignored - """ - - @property - def num_processes(self): - """ Gets the number of MPI worker processes - - .. note:: - Meaningless on SpiNNaker, so we pretend there's one MPI process - - :return: Constant: 1 - :rtype: int - """ - return 1 - - @num_processes.setter - def num_processes(self, new_value): - """ sPyNNaker does not use this value meaningfully - - :param new_value: Ignored - """ - - @property - def dt(self): - """ The machine time step in milliseconds - - :return: the machine time step - :rtype: float - """ - return self.machine_time_step_ms - - @dt.setter - def dt(self, new_value): - """ The machine time step in milliseconds - - :param float new_value: new value for machine time step in microseconds - """ - self.machine_time_step = new_value * MICRO_TO_MILLISECOND_CONVERSION - - @property - def t(self): - """ The current simulation time in milliseconds - - :return: the current runtime already executed - :rtype: float - """ - return self._current_run_timesteps * self.machine_time_step_ms - - @property - def segment_counter(self): - """ The number of the current recording segment being generated. - - :return: the segment counter - :rtype: int - """ - return self.__segment_counter - - @segment_counter.setter - def segment_counter(self, new_value): - """ The number of the current recording segment being generated. - - :param int new_value: new value for the segment counter - """ - self.__segment_counter = new_value - - @property - def running(self): - """ Whether the simulation is running or has run. - - .. note:: - Ties into our has_ran parameter for automatic pause and resume. - - :return: the has_ran variable from the SpiNNaker main interface - :rtype: bool - """ - return self._has_ran - - @running.setter - def running(self, new_value): - """ Setter for the has_ran parameter, only used by the PyNN interface,\ - supports tracking where it thinks its setting this parameter. - - :param bool new_value: the new value for the simulation - """ - self._has_ran = new_value - - @property - def name(self): - """ The name of the simulator. Used to ensure PyNN recording neo\ - blocks are correctly labelled. - - :return: the name of the simulator. - :rtype: str - """ - return _NAME - - @property - def populations(self): - """ The list of all populations in the simulation. - - :return: list of populations - :rtype: list(~spynnaker.pyNN.models.population.Population) - """ - # needed by the population class - return self._populations - - @property - def projections(self): - """ The list of all projections in the simulation. - - :return: list of projections - :rtype: list(~spynnaker.pyNN.models.projection.Projection) - """ - # needed by the projection class. - return self._projections - - @property - def recorders(self): - """ The recorders, used by the PyNN state object - - :return: the internal recorders object - :rtype: list(~spynnaker.pyNN.models.recorder.Recorder) - """ - return self.__recorders - - @recorders.setter - def recorders(self, new_value): - """ Setter for the internal recorders object - - :param new_value: the new value for the recorder - """ - self.__recorders = new_value + moved_in_v6("spynnaker8.spinnaker", + "spynnaker.pyNN.spinnaker") + super(SpiNNaker, self).__init__(database_socket_addresses, + time_scale_factor, min_delay, graph_label, + n_chips_required, n_boards_required, timestep) From cee015f5a62e9eee6afec66adfeda311250ffba0 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 12:01:17 +0100 Subject: [PATCH 05/47] flake8 --- spynnaker8/external_devices/__init__.py | 9 ++++++--- spynnaker8/spinnaker.py | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index ea75aac186..fe320eff3b 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -119,7 +119,8 @@ def continue_simulation(): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.continue_simulation` instead. + :py:method:`spynnaker.pyNN.external_devices.continue_simulation` + instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -165,7 +166,8 @@ def EthernetControlPopulation( .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.EthernetControlPopulation` instead. + :py:method: + `spynnaker.pyNN.external_devices.EthernetControlPopulation` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -182,7 +184,8 @@ def EthernetSensorPopulation( .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.EthernetSensorPopulation` instead. + :py:method:`spynnaker.pyNN.external_devices.EthernetSensorPopulation` + instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") diff --git a/spynnaker8/spinnaker.py b/spynnaker8/spinnaker.py index 0c79a1f93f..891d0e095f 100644 --- a/spynnaker8/spinnaker.py +++ b/spynnaker8/spinnaker.py @@ -32,6 +32,6 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals moved_in_v6("spynnaker8.spinnaker", "spynnaker.pyNN.spinnaker") - super(SpiNNaker, self).__init__(database_socket_addresses, - time_scale_factor, min_delay, graph_label, - n_chips_required, n_boards_required, timestep) + super(SpiNNaker, self).__init__( + database_socket_addresses, time_scale_factor, min_delay, + graph_label, n_chips_required, n_boards_required, timestep) From 7fe9d80c2244a2aad1586d9989558a71c023d25a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 14:13:09 +0100 Subject: [PATCH 06/47] removed inrect im,port via external_devices --- spynnaker/pyNN/external_devices/__init__.py | 47 +-------------------- spynnaker8/external_devices/__init__.py | 3 ++ 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py index 3aecacdaa0..1f91cd6efd 100644 --- a/spynnaker/pyNN/external_devices/__init__.py +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -30,30 +30,13 @@ from spinn_front_end_common.utilities.globals_variables import get_simulator from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon from spynnaker.pyNN.external_devices_models import ( - AbstractEthernetController, AbstractEthernetSensor, - ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, - MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) + AbstractEthernetController, AbstractEthernetSensor) from spynnaker.pyNN.models.utility_models.spike_injector import ( SpikeInjector as ExternalDeviceSpikeInjector) from spynnaker.pyNN import model_binaries from spynnaker.pyNN.connections import ( - EthernetCommandConnection, EthernetControlConnection, - SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) -from spynnaker.pyNN.external_devices_models.push_bot.control import ( - PushBotLifEthernet, PushBotLifSpinnakerLink) -from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( - PushBotSpiNNakerLinkRetinaDevice, - PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, - PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( - PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, - PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, - PushBotEthernetSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( - PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, - PushBotSpeaker, PushBotRetinaViewer) -from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol + EthernetCommandConnection, EthernetControlConnection) from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( SpynnakerExternalDevicePluginManager as Plugins) @@ -70,32 +53,6 @@ spynnaker_external_devices = Plugins() __all__ = [ - "EIEIOType", - - # General Devices - "ExternalCochleaDevice", "ExternalFPGARetinaDevice", - "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", - "PushBotRetinaViewer", "ExternalDeviceLifControl", - - # PushBot Parameters - "MunichIoSpiNNakerLinkProtocol", - "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", - "PushBotRetinaResolution", - - # PushBot Ethernet Parts - "PushBotLifEthernet", "PushBotEthernetLaserDevice", - "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", - "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", - - # PushBot SpiNNaker Link Parts - "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", - "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", - "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", - - # Connections - "SpynnakerLiveSpikesConnection", - "SpynnakerPoissonControlConnection", - # Provided functions "activate_live_output_for", "activate_live_output_to", diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index fe320eff3b..770845b78c 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -88,6 +88,9 @@ "add_poisson_live_rate_control" ] +moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format From a2183568ed7f046c206d98a0f3c5c99ceb3f449c Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 14:13:09 +0100 Subject: [PATCH 07/47] removed indirect import via external_devices --- spynnaker/pyNN/external_devices/__init__.py | 47 +-------------------- spynnaker8/external_devices/__init__.py | 3 ++ 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py index 3aecacdaa0..1f91cd6efd 100644 --- a/spynnaker/pyNN/external_devices/__init__.py +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -30,30 +30,13 @@ from spinn_front_end_common.utilities.globals_variables import get_simulator from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon from spynnaker.pyNN.external_devices_models import ( - AbstractEthernetController, AbstractEthernetSensor, - ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, - MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) + AbstractEthernetController, AbstractEthernetSensor) from spynnaker.pyNN.models.utility_models.spike_injector import ( SpikeInjector as ExternalDeviceSpikeInjector) from spynnaker.pyNN import model_binaries from spynnaker.pyNN.connections import ( - EthernetCommandConnection, EthernetControlConnection, - SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) -from spynnaker.pyNN.external_devices_models.push_bot.control import ( - PushBotLifEthernet, PushBotLifSpinnakerLink) -from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( - PushBotSpiNNakerLinkRetinaDevice, - PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, - PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( - PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, - PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, - PushBotEthernetSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( - PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, - PushBotSpeaker, PushBotRetinaViewer) -from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol + EthernetCommandConnection, EthernetControlConnection) from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( SpynnakerExternalDevicePluginManager as Plugins) @@ -70,32 +53,6 @@ spynnaker_external_devices = Plugins() __all__ = [ - "EIEIOType", - - # General Devices - "ExternalCochleaDevice", "ExternalFPGARetinaDevice", - "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", - "PushBotRetinaViewer", "ExternalDeviceLifControl", - - # PushBot Parameters - "MunichIoSpiNNakerLinkProtocol", - "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", - "PushBotRetinaResolution", - - # PushBot Ethernet Parts - "PushBotLifEthernet", "PushBotEthernetLaserDevice", - "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", - "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", - - # PushBot SpiNNaker Link Parts - "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", - "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", - "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", - - # Connections - "SpynnakerLiveSpikesConnection", - "SpynnakerPoissonControlConnection", - # Provided functions "activate_live_output_for", "activate_live_output_to", diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index fe320eff3b..770845b78c 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -88,6 +88,9 @@ "add_poisson_live_rate_control" ] +moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format From 9a5400bd0c7bb296be079a71c05f06609a835ecd Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 14:36:46 +0100 Subject: [PATCH 08/47] use py:class --- spynnaker8/external_devices/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 770845b78c..8cf67e47a2 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -110,7 +110,7 @@ def run_sync(run_time, sync_time): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.run_sync` instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -122,8 +122,7 @@ def continue_simulation(): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.continue_simulation` - instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -136,7 +135,7 @@ def request_stop(): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.request_stop` instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -148,8 +147,7 @@ def register_database_notification_request(hostname, notify_port, ack_port): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.register_database_notification_request` - instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -169,8 +167,7 @@ def EthernetControlPopulation( .. deprecated:: 6.0 Use - :py:method: - `spynnaker.pyNN.external_devices.EthernetControlPopulation` instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -187,8 +184,7 @@ def EthernetSensorPopulation( .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.EthernetSensorPopulation` - instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") @@ -204,7 +200,7 @@ def SpikeInjector( .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.SpikeInjector` instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ # pylint: disable=too-many-arguments moved_in_v6("spynnaker8.external_devices", From caf36410f97f59582b0efa88dd88bdc0d819f8ea Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 31 Mar 2022 14:44:58 +0100 Subject: [PATCH 09/47] doc fix --- spynnaker8/external_devices/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 8cf67e47a2..73f05b61ec 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -97,7 +97,7 @@ def run_forever(sync_time=0): .. deprecated:: 6.0 Use - :py:method:`spynnaker.pyNN.external_devices.run_forever` instead. + :py:class:`spynnaker.pyNN.external_devices` instead. """ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") From 04ad7986e4d67d27a8e824e7cb6bfa3b49b2b2e0 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 08:24:17 +0100 Subject: [PATCH 10/47] no longer indirect import via external_devices --- spynnaker8/external_devices/__init__.py | 7 +++++++ .../test_external_devices/test_multiboard_spike_output.py | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 73f05b61ec..4db1eba6ee 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -22,6 +22,8 @@ SpiNNaker system to run in real-time mode, which usually reduces numerical accuracy to gain performance. """ +import logging +from spinn_utilities.log import FormatAdapter from spinnman.messages.eieio import EIEIOType from spynnaker.pyNN.external_devices_models import ( ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, @@ -46,6 +48,8 @@ import spynnaker.pyNN.external_devices as moved_code +logger = FormatAdapter(logging.getLogger(__name__)) + # useful functions add_database_socket_address = moved_code.add_database_socket_address activate_live_output_to = moved_code.activate_live_output_to @@ -90,6 +94,9 @@ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") +logger.warning("For imports from spynnaker8.external_devices see imports in " + "https://github.com/SpiNNakerManchester/sPyNNaker/blob/" + "master/spynnaker8/external_devices/__init__.py") def run_forever(sync_time=0): diff --git a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py index ffa988e6c0..583ae89b12 100644 --- a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py +++ b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py @@ -16,8 +16,9 @@ import unittest from unittest import SkipTest from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as p import spynnaker.pyNN.external_devices as e +import spynnaker8 as p +from spynnaker.pyNN.connections import SpynnakerLiveSpikesConnection from spinnaker_testbase import BaseTestCase @@ -51,7 +52,7 @@ def multi_board_spike_output(self): e.activate_live_output_for(pop) TestMultiBoardSpikeOutput.counts[label] = 0 - live_output = e.SpynnakerLiveSpikesConnection( + live_output = SpynnakerLiveSpikesConnection( receive_labels=labels, local_port=None) p.external_devices.add_database_socket_address( live_output.local_ip_address, live_output.local_port, None) From 41ba75c759e77698b611fcf46cfd29b94a0fac59 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 09:58:15 +0100 Subject: [PATCH 11/47] move full external devices to pyNN --- doc/source/modules.rst | 8 --- spynnaker/pyNN/external_devices/__init__.py | 51 +++++++++++++++++-- spynnaker8/__init__.py | 2 +- .../test_multiboard_spike_output.py | 3 +- 4 files changed, 49 insertions(+), 15 deletions(-) diff --git a/doc/source/modules.rst b/doc/source/modules.rst index da2dde5582..384d21584c 100644 --- a/doc/source/modules.rst +++ b/doc/source/modules.rst @@ -5,11 +5,3 @@ spynnaker :maxdepth: 4 spynnaker - -spynnaker8 -========== - -.. toctree:: - :maxdepth: 4 - - spynnaker8 diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py index 1f91cd6efd..5928b50516 100644 --- a/spynnaker/pyNN/external_devices/__init__.py +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,13 +30,30 @@ from spinn_front_end_common.utilities.globals_variables import get_simulator from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon from spynnaker.pyNN.external_devices_models import ( - AbstractEthernetController, AbstractEthernetSensor) + AbstractEthernetController, AbstractEthernetSensor, + ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, + MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) from spynnaker.pyNN.models.utility_models.spike_injector import ( SpikeInjector as ExternalDeviceSpikeInjector) from spynnaker.pyNN import model_binaries from spynnaker.pyNN.connections import ( - EthernetCommandConnection, EthernetControlConnection) + EthernetCommandConnection, EthernetControlConnection, + SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) +from spynnaker.pyNN.external_devices_models.push_bot.control import ( + PushBotLifEthernet, PushBotLifSpinnakerLink) +from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( + PushBotSpiNNakerLinkRetinaDevice, + PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, + PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( + PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, + PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, + PushBotEthernetSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( + PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, + PushBotSpeaker, PushBotRetinaViewer) +from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( SpynnakerExternalDevicePluginManager as Plugins) @@ -53,6 +70,32 @@ spynnaker_external_devices = Plugins() __all__ = [ + "EIEIOType", + + # General Devices + "ExternalCochleaDevice", "ExternalFPGARetinaDevice", + "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", + "PushBotRetinaViewer", "ExternalDeviceLifControl", + + # PushBot Parameters + "MunichIoSpiNNakerLinkProtocol", + "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", + "PushBotRetinaResolution", + + # PushBot Ethernet Parts + "PushBotLifEthernet", "PushBotEthernetLaserDevice", + "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", + "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", + + # PushBot SpiNNaker Link Parts + "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", + "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", + "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", + + # Connections + "SpynnakerLiveSpikesConnection", + "SpynnakerPoissonControlConnection", + # Provided functions "activate_live_output_for", "activate_live_output_to", @@ -255,4 +298,4 @@ def SpikeInjector( Plugins.add_database_socket_address( database_notify_host, database_notify_port_num, database_ack_port_num) - return ExternalDeviceSpikeInjector() + return ExternalDeviceSpikeInjector() \ No newline at end of file diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 3972153f8d..0b3eb2a665 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -106,7 +106,7 @@ # noinspection PyUnresolvedReferences from spynnaker.pyNN.models.projection import Projection as SpiNNakerProjection -from spynnaker8 import external_devices +from spynnaker.pyNN import external_devices from spynnaker8 import extra_models # big stuff diff --git a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py index 583ae89b12..0a2bd881bd 100644 --- a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py +++ b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py @@ -18,7 +18,6 @@ from spynnaker.pyNN.exceptions import ConfigurationException import spynnaker.pyNN.external_devices as e import spynnaker8 as p -from spynnaker.pyNN.connections import SpynnakerLiveSpikesConnection from spinnaker_testbase import BaseTestCase @@ -52,7 +51,7 @@ def multi_board_spike_output(self): e.activate_live_output_for(pop) TestMultiBoardSpikeOutput.counts[label] = 0 - live_output = SpynnakerLiveSpikesConnection( + live_output = p.external_devices.SpynnakerLiveSpikesConnection( receive_labels=labels, local_port=None) p.external_devices.add_database_socket_address( live_output.local_ip_address, live_output.local_port, None) From e15101b5f9e3b41d2517857341015528ec6cca28 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 10:02:59 +0100 Subject: [PATCH 12/47] flake8 --- spynnaker/pyNN/external_devices/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py index 5928b50516..32f22f41b9 100644 --- a/spynnaker/pyNN/external_devices/__init__.py +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -298,4 +298,4 @@ def SpikeInjector( Plugins.add_database_socket_address( database_notify_host, database_notify_port_num, database_ack_port_num) - return ExternalDeviceSpikeInjector() \ No newline at end of file + return ExternalDeviceSpikeInjector() From 8276949b7db192aa7d0f607e03d6001b800b6097 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 10:20:03 +0100 Subject: [PATCH 13/47] combine abstract_spinnake_common and spinkker --- spynnaker/pyNN/abstract_spinnaker_common.py | 511 -------------------- spynnaker/pyNN/external_devices/__init__.py | 9 +- spynnaker/pyNN/spinnaker.py | 479 +++++++++++++++++- 3 files changed, 473 insertions(+), 526 deletions(-) delete mode 100644 spynnaker/pyNN/abstract_spinnaker_common.py diff --git a/spynnaker/pyNN/abstract_spinnaker_common.py b/spynnaker/pyNN/abstract_spinnaker_common.py deleted file mode 100644 index 6416658585..0000000000 --- a/spynnaker/pyNN/abstract_spinnaker_common.py +++ /dev/null @@ -1,511 +0,0 @@ -# Copyright (c) 2017-2019 The University of Manchester -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import logging -import math -import os -from spinn_utilities.log import FormatAdapter -from spinn_utilities.config_holder import get_config_bool, get_config_str -from spinn_utilities.overrides import overrides -from spinn_front_end_common.interface.abstract_spinnaker_base import ( - AbstractSpinnakerBase) -from spinn_front_end_common.interface.provenance import ( - DATA_GENERATION, LOADING, MAPPING, RUN_LOOP) - -from spinn_front_end_common.utilities import FecTimer -from spinn_front_end_common.utilities.constants import ( - MICRO_TO_MILLISECOND_CONVERSION) -from spinn_front_end_common.utilities.exceptions import ConfigurationException -from spinn_front_end_common.utility_models import CommandSender -from spinn_front_end_common.utilities.utility_objs import ExecutableFinder -from spynnaker.pyNN import model_binaries -from spynnaker.pyNN.config_setup import CONFIG_FILE_NAME, setup_configs -from spynnaker.pyNN.utilities import constants -from spynnaker.pyNN.extra_algorithms import ( - delay_support_adder, on_chip_bitfield_generator, - redundant_packet_count_report, - spynnaker_data_specification_writer, - spynnaker_neuron_graph_network_specification_report) -from spynnaker.pyNN.extra_algorithms.\ - spynnaker_machine_bit_field_router_compressor import ( - spynnaker_machine_bitfield_ordered_covering_compressor, - spynnaker_machine_bitField_pair_router_compressor) -from spynnaker.pyNN.extra_algorithms.connection_holder_finisher import ( - finish_connection_holders) -from spynnaker.pyNN.extra_algorithms.splitter_components import ( - spynnaker_splitter_partitioner, spynnaker_splitter_selector) -from spynnaker.pyNN.extra_algorithms.synapse_expander import synapse_expander -logger = FormatAdapter(logging.getLogger(__name__)) - - -class AbstractSpiNNakerCommon(AbstractSpinnakerBase): - """ Main interface for neural code. - """ - __slots__ = [ - "__command_edge_count", - "__edge_count", - "__id_counter", - "__live_spike_recorder", - "__min_delay", - "__neurons_per_core_set", - "_populations", - "_projections"] - - __EXECUTABLE_FINDER = ExecutableFinder() - - def __init__( - self, graph_label, database_socket_addresses, n_chips_required, - n_boards_required, timestep, min_delay, - time_scale_factor=None): - """ - :param str graph_label: - :param database_socket_addresses: - :type database_socket_addresses: - iterable(~spinn_utilities.socket_address.SocketAddress) - :param n_chips_required: - :type n_chips_required: int or None - :param n_boards_required: - :type n_boards_required: int or None - :param timestep: - machine_time_step but in milli seconds. If None uses the cfg value - :type timestep: float or None - :param float min_delay: - :param str hostname: - :param time_scale_factor: - :type time_scale_factor: float or None - """ - # pylint: disable=too-many-arguments, too-many-locals - - setup_configs() - - # add model binaries - self.__EXECUTABLE_FINDER.add_path( - os.path.dirname(model_binaries.__file__)) - - # pynn population objects - self._populations = [] - self._projections = [] - self.__edge_count = 0 - self.__id_counter = 0 - - # the number of edges that are associated with commands being sent to - # a vertex - self.__command_edge_count = 0 - self.__live_spike_recorder = dict() - - # timing parameters - self.__min_delay = None - - self.__neurons_per_core_set = set() - - super().__init__( - executable_finder=self.__EXECUTABLE_FINDER, - graph_label=graph_label, - database_socket_addresses=database_socket_addresses, - n_chips_required=n_chips_required, - n_boards_required=n_boards_required) - - # set up machine targeted data - self._set_up_timings(timestep, min_delay, time_scale_factor) - self.check_machine_specifics() - - logger.info(f'Setting time scale factor to ' - f'{self.time_scale_factor}.') - - # get the machine time step - logger.info(f'Setting machine time step to ' - f'{self.machine_time_step} ' - f'micro-seconds.') - - def _set_up_timings(self, timestep, min_delay, time_scale_factor): - """ - :param timestep: machine_time_Step in milli seconds - :type timestep: float or None - :tpye min_delay: int or None - :type time_scale_factor: int or None - """ - - # Get the standard values - if timestep is None: - self.set_up_timings(timestep, time_scale_factor) - else: - self.set_up_timings( - math.ceil(timestep * MICRO_TO_MILLISECOND_CONVERSION), - time_scale_factor) - - # Sort out the minimum delay - if (min_delay is not None and - min_delay < self.machine_time_step_ms): - raise ConfigurationException( - f"Pacman does not support min delays below " - f"{constants.MIN_SUPPORTED_DELAY * self.machine_time_step} " - f"ms with the current machine time step") - if min_delay is not None: - self.__min_delay = min_delay - else: - self.__min_delay = self.machine_time_step_ms - - # Sort out the time scale factor if not user specified - # (including config) - if self.time_scale_factor is None: - self.time_scale_factor = max( - 1.0, math.ceil( - MICRO_TO_MILLISECOND_CONVERSION / self.machine_time_step)) - if self.time_scale_factor > 1: - logger.warning( - "A timestep was entered that has forced sPyNNaker to " - "automatically slow the simulation down from real time " - "by a factor of {}. To remove this automatic behaviour, " - "please enter a timescaleFactor value in your .{}", - self.time_scale_factor, CONFIG_FILE_NAME) - - # Check the combination of machine time step and time scale factor - if (self.machine_time_step_ms * self.time_scale_factor < 1): - if not get_config_bool( - "Mode", "violate_1ms_wall_clock_restriction"): - raise ConfigurationException( - "The combination of simulation time step and the machine " - "time scale factor results in a wall clock timer tick " - "that is currently not reliably supported by the" - "SpiNNaker machine. If you would like to override this" - "behaviour (at your own risk), please add " - "violate_1ms_wall_clock_restriction = True to the [Mode] " - "section of your .{} file".format(CONFIG_FILE_NAME)) - logger.warning( - "****************************************************") - logger.warning( - "*** The combination of simulation time step and ***") - logger.warning( - "*** the machine time scale factor results in a ***") - logger.warning( - "*** wall clock timer tick that is currently not ***") - logger.warning( - "*** reliably supported by the SpiNNaker machine. ***") - logger.warning( - "****************************************************") - - def _detect_if_graph_has_changed(self, reset_flags=True): - """ Iterate though the graph and look for changes. - - :param bool reset_flags: - """ - changed, data_changed = super()._detect_if_graph_has_changed( - reset_flags) - - # Additionally check populations for changes - for population in self._populations: - if population.requires_mapping: - changed = True - if reset_flags: - population.mark_no_changes() - - # Additionally check projections for changes - for projection in self._projections: - if projection.requires_mapping: - changed = True - if reset_flags: - projection.mark_no_changes() - - return changed, data_changed - - @property - def min_delay(self): - """ The minimum supported delay, in milliseconds. - """ - return self.__min_delay - - def add_application_vertex(self, vertex): - if isinstance(vertex, CommandSender): - raise NotImplementedError( - "Please contact spinnker team as adding a CommandSender " - "currently disabled") - super().add_application_vertex(vertex) - - @staticmethod - def _count_unique_keys(commands): - unique_keys = {command.key for command in commands} - return len(unique_keys) - - def add_population(self, population): - """ Called by each population to add itself to the list. - """ - self._populations.append(population) - - def add_projection(self, projection): - """ Called by each projection to add itself to the list. - """ - self._projections.append(projection) - - def stop(self, turn_off_machine=None, clear_routing_tables=None, - clear_tags=None): - """ - :param turn_off_machine: decides if the machine should be powered down - after running the execution. Note that this powers down all boards - connected to the BMP connections given to the transceiver - :type turn_off_machine: bool or None - :param clear_routing_tables: informs the tool chain if it - should turn off the clearing of the routing tables - :type clear_routing_tables: bool or None - :param clear_tags: informs the tool chain if it should clear the tags - off the machine at stop - :type clear_tags: bool or None - :rtype: None - """ - # pylint: disable=protected-access - for population in self._populations: - population._end() - - super().stop(turn_off_machine, clear_routing_tables, clear_tags) - self.reset_number_of_neurons_per_core() - - def run(self, run_time, sync_time=0.0): - """ Run the model created. - - :param run_time: the time (in milliseconds) to run the simulation for - :type run_time: float or int - :param float sync_time: - If not 0, this specifies that the simulation should pause after - this duration. The continue_simulation() method must then be - called for the simulation to continue. - :rtype: None - """ - # pylint: disable=protected-access - - # extra post run algorithms - for projection in self._projections: - projection._clear_cache() - - super().run(run_time, sync_time) - for projection in self._projections: - projection._clear_cache() - - @staticmethod - def register_binary_search_path(search_path): - """ Register an additional binary search path for executables. - - :param str search_path: absolute search path for binaries - :rtype: None - """ - # pylint: disable=protected-access - AbstractSpiNNakerCommon.__EXECUTABLE_FINDER.add_path(search_path) - - def set_number_of_neurons_per_core(self, neuron_type, max_permitted): - if not hasattr(neuron_type, "set_model_max_atoms_per_core"): - raise Exception("{} is not a Vertex type".format(neuron_type)) - - if hasattr(neuron_type, "get_max_atoms_per_core"): - previous = neuron_type.get_max_atoms_per_core() - if previous < max_permitted: - logger.warning( - "Attempt to increase number_of_neurons_per_core " - "from {} to {} ignored", previous, max_permitted) - return - neuron_type.set_model_max_atoms_per_core(max_permitted) - self.__neurons_per_core_set.add(neuron_type) - - def reset_number_of_neurons_per_core(self): - for neuron_type in self.__neurons_per_core_set: - neuron_type.set_model_max_atoms_per_core() - - def _locate_receivers_from_projections( - self, projections, gatherers, extra_monitors_per_chip): - """ Locate receivers and their corresponding monitor cores for\ - setting router time-outs. - - :param list projections: the projections going to be read - :param gatherers: the gatherers per Ethernet chip - :param extra_monitors_per_chip: the extra monitor cores per chip - :return: list of tuples with gatherer and its extra monitor cores - :rtype: list - """ - # pylint: disable=protected-access - important_gathers = set() - - # iterate though projections - for projection in projections: - # iteration though the projections machine edges to locate chips - for edge in projection._projection_edge.machine_edges: - placement = self._placements.get_placement_of_vertex( - edge.post_vertex) - chip = self._machine.get_chip_at(placement.x, placement.y) - - # locate extra monitor cores on the board of this chip - extra_monitor_cores_on_board = set( - extra_monitors_per_chip[xy] - for xy in self._machine.get_existing_xys_on_board(chip)) - - # map gatherer to extra monitor cores for board - important_gathers.add(( - gatherers[(chip.nearest_ethernet_x, - chip.nearest_ethernet_y)], - frozenset(extra_monitor_cores_on_board))) - return list(important_gathers) - - @property - def id_counter(self): - """ The id_counter, currently used by the populations. - - .. note:: - Maybe it could live in the pop class??? - - :rtype: int - """ - return self.__id_counter - - @id_counter.setter - def id_counter(self, new_value): - """ Setter for id_counter, currently used by the populations. - - .. note:: - Maybe it could live in the pop class??? - - :param int new_value: new value for id_counter - """ - self.__id_counter = new_value - - @overrides(AbstractSpinnakerBase._execute_graph_data_specification_writer) - def _execute_graph_data_specification_writer(self): - with FecTimer(DATA_GENERATION, "Spynnaker data specification writer"): - self._dsg_targets = spynnaker_data_specification_writer( - self._placements, self._ipaddress, self._machine, - self._app_id, self._max_run_time_steps) - - def _execute_spynnaker_ordered_covering_compressor(self): - with FecTimer( - LOADING, - "Spynnaker machine bitfield ordered covering compressor") \ - as timer: - if timer.skip_if_virtual_board(): - return - spynnaker_machine_bitfield_ordered_covering_compressor( - self._router_tables, self._txrx, self._machine, self._app_id, - self._machine_graph, self._placements, self._executable_finder, - self._routing_infos, self._executable_targets, - get_config_bool("Reports", "write_expander_iobuf")) - self._multicast_routes_loaded = True - return None - - def _execute_spynnaker_pair_compressor(self): - with FecTimer( - LOADING, "Spynnaker machine bitfield pair router compressor") \ - as timer: - if timer.skip_if_virtual_board(): - return - spynnaker_machine_bitField_pair_router_compressor( - self._router_tables, self._txrx, self._machine, self._app_id, - self._machine_graph, self._placements, self._executable_finder, - self._routing_infos, self._executable_targets, - get_config_bool("Reports", "write_expander_iobuf")) - self._multicast_routes_loaded = True - return None - - @overrides(AbstractSpinnakerBase._do_delayed_compression) - def _do_delayed_compression(self, name, compressed): - if name == "SpynnakerMachineBitFieldOrderedCoveringCompressor": - return self._execute_spynnaker_ordered_covering_compressor() - - if name == "SpynnakerMachineBitFieldPairRouterCompressor": - return self._execute_spynnaker_pair_compressor() - - return AbstractSpinnakerBase._do_delayed_compression( - self, name, compressed) - - def _execute_synapse_expander(self): - with FecTimer(LOADING, "Synapse expander") as timer: - if timer.skip_if_virtual_board(): - return - synapse_expander( - self.placements, self._txrx, self._executable_finder, - get_config_bool("Reports", "write_expander_iobuf")) - - def _execute_on_chip_bit_field_generator(self): - with FecTimer(LOADING, "Execute on chip bitfield generator") as timer: - if timer.skip_if_virtual_board(): - return - on_chip_bitfield_generator( - self.placements, self.application_graph, - self._executable_finder, self._txrx, self._machine_graph, - self._routing_infos) - - def _execute_finish_connection_holders(self): - with FecTimer(LOADING, "Finish connection holders"): - finish_connection_holders(self.application_graph) - - @overrides(AbstractSpinnakerBase._do_extra_load_algorithms) - def _do_extra_load_algorithms(self): - self._execute_synapse_expander() - self._execute_on_chip_bit_field_generator() - self._execute_finish_connection_holders() - - def _execute_write_network_graph(self): - with FecTimer( - MAPPING, - "SpYNNakerNeuronGraphNetworkSpecificationReport") as timer: - if timer.skip_if_cfg_false("Reports", "write_network_graph"): - return - spynnaker_neuron_graph_network_specification_report( - self._application_graph) - - @overrides(AbstractSpinnakerBase._do_extra_mapping_algorithms, - extend_doc=False) - def _do_extra_mapping_algorithms(self): - self._execute_write_network_graph() - - @overrides(AbstractSpinnakerBase._do_provenance_reports) - def _do_provenance_reports(self): - AbstractSpinnakerBase._do_provenance_reports(self) - self._report_redundant_packet_count() - - def _report_redundant_packet_count(self): - with FecTimer(RUN_LOOP, "Redundant packet count report") as timer: - if timer.skip_if_cfg_false( - "Reports", "write_redundant_packet_count_report"): - return - redundant_packet_count_report() - - @overrides(AbstractSpinnakerBase._execute_splitter_selector) - def _execute_splitter_selector(self): - with FecTimer(MAPPING, "Spynnaker splitter selector"): - spynnaker_splitter_selector(self._application_graph) - - @overrides(AbstractSpinnakerBase._execute_delay_support_adder, - extend_doc=False) - def _execute_delay_support_adder(self): - """ - Runs, times and logs the DelaySupportAdder if required - """ - name = get_config_str("Mapping", "delay_support_adder") - if name is None: - return - with FecTimer(MAPPING, "DelaySupportAdder"): - if name == "DelaySupportAdder": - delay_support_adder(self._application_graph) - return - raise ConfigurationException( - f"Unexpected cfg setting delay_support_adder: {name}") - - @overrides(AbstractSpinnakerBase._execute_splitter_partitioner) - def _execute_splitter_partitioner(self, pre_allocated_resources): - if not self._application_graph.n_vertices: - return - with FecTimer(MAPPING, "SpynnakerSplitterPartitioner"): - if self._machine: - machine = self._machine - else: - machine = self._max_machine - self._machine_graph, self._n_chips_needed = \ - spynnaker_splitter_partitioner( - self._application_graph, machine, self._plan_n_timesteps, - pre_allocated_resources) diff --git a/spynnaker/pyNN/external_devices/__init__.py b/spynnaker/pyNN/external_devices/__init__.py index 32f22f41b9..29ae8acd05 100644 --- a/spynnaker/pyNN/external_devices/__init__.py +++ b/spynnaker/pyNN/external_devices/__init__.py @@ -28,14 +28,10 @@ from spinn_front_end_common.abstract_models import ( AbstractSendMeMulticastCommandsVertex) from spinn_front_end_common.utilities.globals_variables import get_simulator -from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon from spynnaker.pyNN.external_devices_models import ( AbstractEthernetController, AbstractEthernetSensor, ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) -from spynnaker.pyNN.models.utility_models.spike_injector import ( - SpikeInjector as - ExternalDeviceSpikeInjector) from spynnaker.pyNN import model_binaries from spynnaker.pyNN.connections import ( EthernetCommandConnection, EthernetControlConnection, @@ -54,10 +50,13 @@ PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, PushBotSpeaker, PushBotRetinaViewer) from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol +from spynnaker.pyNN.spinnaker import SpiNNaker from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( SpynnakerExternalDevicePluginManager as Plugins) from spynnaker.pyNN.models.populations import Population +from spynnaker.pyNN.models.utility_models.spike_injector import ( + SpikeInjector as ExternalDeviceSpikeInjector) # useful functions add_database_socket_address = Plugins.add_database_socket_address @@ -65,7 +64,7 @@ activate_live_output_for = Plugins.activate_live_output_for add_poisson_live_rate_control = Plugins.add_poisson_live_rate_control -AbstractSpiNNakerCommon.register_binary_search_path( +SpiNNaker.register_binary_search_path( os.path.dirname(model_binaries.__file__)) spynnaker_external_devices = Plugins() diff --git a/spynnaker/pyNN/spinnaker.py b/spynnaker/pyNN/spinnaker.py index bb9d69a15f..cb68025e10 100644 --- a/spynnaker/pyNN/spinnaker.py +++ b/spynnaker/pyNN/spinnaker.py @@ -13,27 +13,71 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import logging from lazyarray import __version__ as lazyarray_version from quantities import __version__ as quantities_version +import math from neo import __version__ as neo_version +import os from pyNN.common import control as pynn_control from pyNN import __version__ as pynn_version -from spinn_front_end_common.utilities.constants import ( - MICRO_TO_MILLISECOND_CONVERSION) + +from spinn_utilities.log import FormatAdapter +from spinn_utilities.config_holder import get_config_bool, get_config_str +from spinn_utilities.overrides import overrides + from spinn_front_end_common.interface.abstract_spinnaker_base import ( AbstractSpinnakerBase) -from spinn_front_end_common.interface.provenance import ProvenanceWriter -from spynnaker.pyNN.abstract_spinnaker_common import AbstractSpiNNakerCommon +from spinn_front_end_common.interface.provenance import ( + DATA_GENERATION, LOADING, MAPPING, ProvenanceWriter, RUN_LOOP) +from spinn_front_end_common.utilities import FecTimer +from spinn_front_end_common.utilities.constants import ( + MICRO_TO_MILLISECOND_CONVERSION) +from spinn_front_end_common.utilities.exceptions import ConfigurationException +from spinn_front_end_common.utility_models import CommandSender +from spinn_front_end_common.utilities.utility_objs import ExecutableFinder + from spynnaker import _version +from spynnaker.pyNN import model_binaries +from spynnaker.pyNN.config_setup import CONFIG_FILE_NAME, setup_configs +from spynnaker.pyNN.extra_algorithms import ( + delay_support_adder, on_chip_bitfield_generator, + redundant_packet_count_report, + spynnaker_data_specification_writer, + spynnaker_neuron_graph_network_specification_report) +from spynnaker.pyNN.extra_algorithms.\ + spynnaker_machine_bit_field_router_compressor import ( + spynnaker_machine_bitfield_ordered_covering_compressor, + spynnaker_machine_bitField_pair_router_compressor) +from spynnaker.pyNN.extra_algorithms.connection_holder_finisher import ( + finish_connection_holders) +from spynnaker.pyNN.extra_algorithms.splitter_components import ( + spynnaker_splitter_partitioner, spynnaker_splitter_selector) +from spynnaker.pyNN.extra_algorithms.synapse_expander import synapse_expander +from spynnaker.pyNN.utilities import constants + +logger = FormatAdapter(logging.getLogger(__name__)) _NAME = "SpiNNaker_under_version({}-{})".format( _version.__version__, _version.__version_name__) -class SpiNNaker(AbstractSpiNNakerCommon, pynn_control.BaseState): +class SpiNNaker(AbstractSpinnakerBase, pynn_control.BaseState): """ Main interface for the sPyNNaker implementation of PyNN 0.8/0.9 """ + __slots__ = [ + "__command_edge_count", + "__edge_count", + "__id_counter", + "__live_spike_recorder", + "__min_delay", + "__neurons_per_core_set", + "_populations", + "_projections"] + + __EXECUTABLE_FINDER = ExecutableFinder() + def __init__( self, database_socket_addresses, time_scale_factor, min_delay, graph_label, @@ -56,12 +100,46 @@ def __init__( pynn_control.BaseState.__init__(self) # SpiNNaker setup - super(SpiNNaker, self).__init__( + setup_configs() + + # add model binaries + self.__EXECUTABLE_FINDER.add_path( + os.path.dirname(model_binaries.__file__)) + + # pynn population objects + self._populations = [] + self._projections = [] + self.__edge_count = 0 + self.__id_counter = 0 + + # the number of edges that are associated with commands being sent to + # a vertex + self.__command_edge_count = 0 + self.__live_spike_recorder = dict() + + # timing parameters + self.__min_delay = None + + self.__neurons_per_core_set = set() + + super().__init__( + executable_finder=self.__EXECUTABLE_FINDER, + graph_label=graph_label, database_socket_addresses=database_socket_addresses, - graph_label=graph_label, n_chips_required=n_chips_required, - n_boards_required=n_boards_required, - min_delay=min_delay, - timestep=timestep, time_scale_factor=time_scale_factor) + n_chips_required=n_chips_required, + n_boards_required=n_boards_required) + + # set up machine targeted data + self._set_up_timings(timestep, min_delay, time_scale_factor) + self.check_machine_specifics() + + logger.info(f'Setting time scale factor to ' + f'{self.time_scale_factor}.') + + # get the machine time step + logger.info(f'Setting machine time step to ' + f'{self.machine_time_step} ' + f'micro-seconds.') with ProvenanceWriter() as db: db.insert_version("sPyNNaker_version", _version.__version__) @@ -275,3 +353,384 @@ def recorders(self, new_value): :param new_value: the new value for the recorder """ self.__recorders = new_value + + def _set_up_timings(self, timestep, min_delay, time_scale_factor): + """ + :param timestep: machine_time_Step in milli seconds + :type timestep: float or None + :tpye min_delay: int or None + :type time_scale_factor: int or None + """ + + # Get the standard values + if timestep is None: + self.set_up_timings(timestep, time_scale_factor) + else: + self.set_up_timings( + math.ceil(timestep * MICRO_TO_MILLISECOND_CONVERSION), + time_scale_factor) + + # Sort out the minimum delay + if (min_delay is not None and + min_delay < self.machine_time_step_ms): + raise ConfigurationException( + f"Pacman does not support min delays below " + f"{constants.MIN_SUPPORTED_DELAY * self.machine_time_step} " + f"ms with the current machine time step") + if min_delay is not None: + self.__min_delay = min_delay + else: + self.__min_delay = self.machine_time_step_ms + + # Sort out the time scale factor if not user specified + # (including config) + if self.time_scale_factor is None: + self.time_scale_factor = max( + 1.0, math.ceil( + MICRO_TO_MILLISECOND_CONVERSION / self.machine_time_step)) + if self.time_scale_factor > 1: + logger.warning( + "A timestep was entered that has forced sPyNNaker to " + "automatically slow the simulation down from real time " + "by a factor of {}. To remove this automatic behaviour, " + "please enter a timescaleFactor value in your .{}", + self.time_scale_factor, CONFIG_FILE_NAME) + + # Check the combination of machine time step and time scale factor + if (self.machine_time_step_ms * self.time_scale_factor < 1): + if not get_config_bool( + "Mode", "violate_1ms_wall_clock_restriction"): + raise ConfigurationException( + "The combination of simulation time step and the machine " + "time scale factor results in a wall clock timer tick " + "that is currently not reliably supported by the" + "SpiNNaker machine. If you would like to override this" + "behaviour (at your own risk), please add " + "violate_1ms_wall_clock_restriction = True to the [Mode] " + "section of your .{} file".format(CONFIG_FILE_NAME)) + logger.warning( + "****************************************************") + logger.warning( + "*** The combination of simulation time step and ***") + logger.warning( + "*** the machine time scale factor results in a ***") + logger.warning( + "*** wall clock timer tick that is currently not ***") + logger.warning( + "*** reliably supported by the SpiNNaker machine. ***") + logger.warning( + "****************************************************") + + def _detect_if_graph_has_changed(self, reset_flags=True): + """ Iterate though the graph and look for changes. + + :param bool reset_flags: + """ + changed, data_changed = super()._detect_if_graph_has_changed( + reset_flags) + + # Additionally check populations for changes + for population in self._populations: + if population.requires_mapping: + changed = True + if reset_flags: + population.mark_no_changes() + + # Additionally check projections for changes + for projection in self._projections: + if projection.requires_mapping: + changed = True + if reset_flags: + projection.mark_no_changes() + + return changed, data_changed + + @property + def min_delay(self): + """ The minimum supported delay, in milliseconds. + """ + return self.__min_delay + + def add_application_vertex(self, vertex): + if isinstance(vertex, CommandSender): + raise NotImplementedError( + "Please contact spinnker team as adding a CommandSender " + "currently disabled") + super().add_application_vertex(vertex) + + @staticmethod + def _count_unique_keys(commands): + unique_keys = {command.key for command in commands} + return len(unique_keys) + + def add_population(self, population): + """ Called by each population to add itself to the list. + """ + self._populations.append(population) + + def add_projection(self, projection): + """ Called by each projection to add itself to the list. + """ + self._projections.append(projection) + + def stop(self, turn_off_machine=None, clear_routing_tables=None, + clear_tags=None): + """ + :param turn_off_machine: decides if the machine should be powered down + after running the execution. Note that this powers down all boards + connected to the BMP connections given to the transceiver + :type turn_off_machine: bool or None + :param clear_routing_tables: informs the tool chain if it + should turn off the clearing of the routing tables + :type clear_routing_tables: bool or None + :param clear_tags: informs the tool chain if it should clear the tags + off the machine at stop + :type clear_tags: bool or None + :rtype: None + """ + # pylint: disable=protected-access + for population in self._populations: + population._end() + + super().stop(turn_off_machine, clear_routing_tables, clear_tags) + self.reset_number_of_neurons_per_core() + + def run(self, run_time, sync_time=0.0): + """ Run the model created. + + :param run_time: the time (in milliseconds) to run the simulation for + :type run_time: float or int + :param float sync_time: + If not 0, this specifies that the simulation should pause after + this duration. The continue_simulation() method must then be + called for the simulation to continue. + :rtype: None + """ + # pylint: disable=protected-access + + # extra post run algorithms + for projection in self._projections: + projection._clear_cache() + + super().run(run_time, sync_time) + for projection in self._projections: + projection._clear_cache() + + @staticmethod + def register_binary_search_path(search_path): + """ Register an additional binary search path for executables. + + :param str search_path: absolute search path for binaries + :rtype: None + """ + # pylint: disable=protected-access + SpiNNaker.__EXECUTABLE_FINDER.add_path(search_path) + + def set_number_of_neurons_per_core(self, neuron_type, max_permitted): + if not hasattr(neuron_type, "set_model_max_atoms_per_core"): + raise Exception("{} is not a Vertex type".format(neuron_type)) + + if hasattr(neuron_type, "get_max_atoms_per_core"): + previous = neuron_type.get_max_atoms_per_core() + if previous < max_permitted: + logger.warning( + "Attempt to increase number_of_neurons_per_core " + "from {} to {} ignored", previous, max_permitted) + return + neuron_type.set_model_max_atoms_per_core(max_permitted) + self.__neurons_per_core_set.add(neuron_type) + + def reset_number_of_neurons_per_core(self): + for neuron_type in self.__neurons_per_core_set: + neuron_type.set_model_max_atoms_per_core() + + def _locate_receivers_from_projections( + self, projections, gatherers, extra_monitors_per_chip): + """ Locate receivers and their corresponding monitor cores for\ + setting router time-outs. + + :param list projections: the projections going to be read + :param gatherers: the gatherers per Ethernet chip + :param extra_monitors_per_chip: the extra monitor cores per chip + :return: list of tuples with gatherer and its extra monitor cores + :rtype: list + """ + # pylint: disable=protected-access + important_gathers = set() + + # iterate though projections + for projection in projections: + # iteration though the projections machine edges to locate chips + for edge in projection._projection_edge.machine_edges: + placement = self._placements.get_placement_of_vertex( + edge.post_vertex) + chip = self._machine.get_chip_at(placement.x, placement.y) + + # locate extra monitor cores on the board of this chip + extra_monitor_cores_on_board = set( + extra_monitors_per_chip[xy] + for xy in self._machine.get_existing_xys_on_board(chip)) + + # map gatherer to extra monitor cores for board + important_gathers.add(( + gatherers[(chip.nearest_ethernet_x, + chip.nearest_ethernet_y)], + frozenset(extra_monitor_cores_on_board))) + return list(important_gathers) + + @property + def id_counter(self): + """ The id_counter, currently used by the populations. + + .. note:: + Maybe it could live in the pop class??? + + :rtype: int + """ + return self.__id_counter + + @id_counter.setter + def id_counter(self, new_value): + """ Setter for id_counter, currently used by the populations. + + .. note:: + Maybe it could live in the pop class??? + + :param int new_value: new value for id_counter + """ + self.__id_counter = new_value + + @overrides(AbstractSpinnakerBase._execute_graph_data_specification_writer) + def _execute_graph_data_specification_writer(self): + with FecTimer(DATA_GENERATION, "Spynnaker data specification writer"): + self._dsg_targets = spynnaker_data_specification_writer( + self._placements, self._ipaddress, self._machine, + self._app_id, self._max_run_time_steps) + + def _execute_spynnaker_ordered_covering_compressor(self): + with FecTimer( + LOADING, + "Spynnaker machine bitfield ordered covering compressor") \ + as timer: + if timer.skip_if_virtual_board(): + return + spynnaker_machine_bitfield_ordered_covering_compressor( + self._router_tables, self._txrx, self._machine, self._app_id, + self._machine_graph, self._placements, self._executable_finder, + self._routing_infos, self._executable_targets, + get_config_bool("Reports", "write_expander_iobuf")) + self._multicast_routes_loaded = True + return None + + def _execute_spynnaker_pair_compressor(self): + with FecTimer( + LOADING, "Spynnaker machine bitfield pair router compressor") \ + as timer: + if timer.skip_if_virtual_board(): + return + spynnaker_machine_bitField_pair_router_compressor( + self._router_tables, self._txrx, self._machine, self._app_id, + self._machine_graph, self._placements, self._executable_finder, + self._routing_infos, self._executable_targets, + get_config_bool("Reports", "write_expander_iobuf")) + self._multicast_routes_loaded = True + return None + + @overrides(AbstractSpinnakerBase._do_delayed_compression) + def _do_delayed_compression(self, name, compressed): + if name == "SpynnakerMachineBitFieldOrderedCoveringCompressor": + return self._execute_spynnaker_ordered_covering_compressor() + + if name == "SpynnakerMachineBitFieldPairRouterCompressor": + return self._execute_spynnaker_pair_compressor() + + return AbstractSpinnakerBase._do_delayed_compression( + self, name, compressed) + + def _execute_synapse_expander(self): + with FecTimer(LOADING, "Synapse expander") as timer: + if timer.skip_if_virtual_board(): + return + synapse_expander( + self.placements, self._txrx, self._executable_finder, + get_config_bool("Reports", "write_expander_iobuf")) + + def _execute_on_chip_bit_field_generator(self): + with FecTimer(LOADING, "Execute on chip bitfield generator") as timer: + if timer.skip_if_virtual_board(): + return + on_chip_bitfield_generator( + self.placements, self.application_graph, + self._executable_finder, self._txrx, self._machine_graph, + self._routing_infos) + + def _execute_finish_connection_holders(self): + with FecTimer(LOADING, "Finish connection holders"): + finish_connection_holders(self.application_graph) + + @overrides(AbstractSpinnakerBase._do_extra_load_algorithms) + def _do_extra_load_algorithms(self): + self._execute_synapse_expander() + self._execute_on_chip_bit_field_generator() + self._execute_finish_connection_holders() + + def _execute_write_network_graph(self): + with FecTimer( + MAPPING, + "SpYNNakerNeuronGraphNetworkSpecificationReport") as timer: + if timer.skip_if_cfg_false("Reports", "write_network_graph"): + return + spynnaker_neuron_graph_network_specification_report( + self._application_graph) + + @overrides(AbstractSpinnakerBase._do_extra_mapping_algorithms, + extend_doc=False) + def _do_extra_mapping_algorithms(self): + self._execute_write_network_graph() + + @overrides(AbstractSpinnakerBase._do_provenance_reports) + def _do_provenance_reports(self): + AbstractSpinnakerBase._do_provenance_reports(self) + self._report_redundant_packet_count() + + def _report_redundant_packet_count(self): + with FecTimer(RUN_LOOP, "Redundant packet count report") as timer: + if timer.skip_if_cfg_false( + "Reports", "write_redundant_packet_count_report"): + return + redundant_packet_count_report() + + @overrides(AbstractSpinnakerBase._execute_splitter_selector) + def _execute_splitter_selector(self): + with FecTimer(MAPPING, "Spynnaker splitter selector"): + spynnaker_splitter_selector(self._application_graph) + + @overrides(AbstractSpinnakerBase._execute_delay_support_adder, + extend_doc=False) + def _execute_delay_support_adder(self): + """ + Runs, times and logs the DelaySupportAdder if required + """ + name = get_config_str("Mapping", "delay_support_adder") + if name is None: + return + with FecTimer(MAPPING, "DelaySupportAdder"): + if name == "DelaySupportAdder": + delay_support_adder(self._application_graph) + return + raise ConfigurationException( + f"Unexpected cfg setting delay_support_adder: {name}") + + @overrides(AbstractSpinnakerBase._execute_splitter_partitioner) + def _execute_splitter_partitioner(self, pre_allocated_resources): + if not self._application_graph.n_vertices: + return + with FecTimer(MAPPING, "SpynnakerSplitterPartitioner"): + if self._machine: + machine = self._machine + else: + machine = self._max_machine + self._machine_graph, self._n_chips_needed = \ + spynnaker_splitter_partitioner( + self._application_graph, machine, self._plan_n_timesteps, + pre_allocated_resources) From 32974a971006addcfad0c5062092a4f0ff8e5888 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 10:36:24 +0100 Subject: [PATCH 14/47] test remove spynakker8 external devices --- spynnaker8/external_devices/__init__.py | 217 ------------------------ 1 file changed, 217 deletions(-) delete mode 100644 spynnaker8/external_devices/__init__.py diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py deleted file mode 100644 index 4db1eba6ee..0000000000 --- a/spynnaker8/external_devices/__init__.py +++ /dev/null @@ -1,217 +0,0 @@ -# Copyright (c) 2017-2019 The University of Manchester -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -""" -This contains functions and classes for handling external devices such as the -PushBot (http://spinnakermanchester.github.io/docs/push_bot/). - -.. note:: - When using external devices, it is normally important to configure your - SpiNNaker system to run in real-time mode, which usually reduces numerical - accuracy to gain performance. -""" -import logging -from spinn_utilities.log import FormatAdapter -from spinnman.messages.eieio import EIEIOType -from spynnaker.pyNN.external_devices_models import ( - ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, - MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) -from spynnaker.pyNN.connections import ( - SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) -from spynnaker.pyNN.external_devices_models.push_bot.control import ( - PushBotLifEthernet, PushBotLifSpinnakerLink) -from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( - PushBotSpiNNakerLinkRetinaDevice, - PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, - PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( - PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, - PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, - PushBotEthernetSpeakerDevice) -from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( - PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, - PushBotSpeaker, PushBotRetinaViewer) -from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol -from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 - -import spynnaker.pyNN.external_devices as moved_code - -logger = FormatAdapter(logging.getLogger(__name__)) - -# useful functions -add_database_socket_address = moved_code.add_database_socket_address -activate_live_output_to = moved_code.activate_live_output_to -activate_live_output_for = moved_code.activate_live_output_for -add_poisson_live_rate_control = moved_code.add_poisson_live_rate_control - -__all__ = [ - "EIEIOType", - - # General Devices - "ExternalCochleaDevice", "ExternalFPGARetinaDevice", - "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", - "PushBotRetinaViewer", "ExternalDeviceLifControl", - - # PushBot Parameters - "MunichIoSpiNNakerLinkProtocol", - "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", - "PushBotRetinaResolution", - - # PushBot Ethernet Parts - "PushBotLifEthernet", "PushBotEthernetLaserDevice", - "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", - "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", - - # PushBot SpiNNaker Link Parts - "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", - "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", - "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", - - # Connections - "SpynnakerLiveSpikesConnection", - "SpynnakerPoissonControlConnection", - - # Provided functions - "activate_live_output_for", - "activate_live_output_to", - "SpikeInjector", - "register_database_notification_request", - "run_forever", - "add_poisson_live_rate_control" -] - -moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") -logger.warning("For imports from spynnaker8.external_devices see imports in " - "https://github.com/SpiNNakerManchester/sPyNNaker/blob/" - "master/spynnaker8/external_devices/__init__.py") - - -def run_forever(sync_time=0): - """ Supports running forever in PyNN 0.8/0.9 format - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - moved_code.run_forever(sync_time) - - -def run_sync(run_time, sync_time): - """ Run in steps of the given number of milliseconds pausing between\ - for a signal to be sent from the host - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - moved_code.run_sync(run_time, sync_time) - - -def continue_simulation(): - """ Continue a synchronised simulation - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - moved_code.continue_simulation() - - -def request_stop(): - """ Request a stop in the simulation without a complete stop. Will stop\ - after the next auto-pause-and-resume cycle - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - moved_code.request_stop() - - -def register_database_notification_request(hostname, notify_port, ack_port): - """ Adds a socket system which is registered with the notification protocol - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - moved_code.register_database_notification_request( - hostname, notify_port, ack_port) - - -# Store the connection to be used by multiple users -__ethernet_control_connection = None - - -def EthernetControlPopulation( - n_neurons, model, label=None, local_host=None, local_port=None, - database_notify_port_num=None, database_ack_port_num=None): - """ Create a PyNN population that can be included in a network to\ - control an external device which is connected to the host - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - return moved_code.EthernetControlPopulation( - n_neurons, model, label, local_host, local_port, - database_notify_port_num, database_ack_port_num) - - -def EthernetSensorPopulation( - device, local_host=None, - database_notify_port_num=None, database_ack_port_num=None): - """ Create a pyNN population which can be included in a network to\ - receive spikes from a device connected to the host - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - return moved_code.EthernetSensorPopulation( - device, local_host, database_notify_port_num, database_ack_port_num) - - -def SpikeInjector( - notify=True, database_notify_host=None, database_notify_port_num=None, - database_ack_port_num=None): - """ Supports creating a spike injector that can be added to the\ - application graph. - - .. deprecated:: 6.0 - Use - :py:class:`spynnaker.pyNN.external_devices` instead. - """ - # pylint: disable=too-many-arguments - moved_in_v6("spynnaker8.external_devices", - "spynnaker.pyNN.external_devices") - return moved_code.SpikeInjector( - notify, database_notify_host, database_notify_port_num, - database_ack_port_num) From 0734174da2540ba4d7ebbec30d84791f3bcc5332 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 10:52:46 +0100 Subject: [PATCH 15/47] merge run calls --- spynnaker/pyNN/spinnaker.py | 38 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/spynnaker/pyNN/spinnaker.py b/spynnaker/pyNN/spinnaker.py index cb68025e10..1180846544 100644 --- a/spynnaker/pyNN/spinnaker.py +++ b/spynnaker/pyNN/spinnaker.py @@ -149,13 +149,25 @@ def __init__( db.insert_version("lazyarray_version", lazyarray_version) def run(self, run_time, sync_time=0.0): - """ Run the simulation for a span of simulation time. + """ Run the model created. - :param run_time: the time to run for, in milliseconds - :return: None + :param run_time: the time (in milliseconds) to run the simulation for + :type run_time: float or int + :param float sync_time: + If not 0, this specifies that the simulation should pause after + this duration. The continue_simulation() method must then be + called for the simulation to continue. + :rtype: None """ + # pylint: disable=protected-access + + # extra post run algorithms + for projection in self._projections: + projection._clear_cache() self._run_wait(run_time, sync_time) + for projection in self._projections: + projection._clear_cache() def run_until(self, tstop): """ Run the simulation until the given simulation time. @@ -495,26 +507,6 @@ def stop(self, turn_off_machine=None, clear_routing_tables=None, super().stop(turn_off_machine, clear_routing_tables, clear_tags) self.reset_number_of_neurons_per_core() - def run(self, run_time, sync_time=0.0): - """ Run the model created. - - :param run_time: the time (in milliseconds) to run the simulation for - :type run_time: float or int - :param float sync_time: - If not 0, this specifies that the simulation should pause after - this duration. The continue_simulation() method must then be - called for the simulation to continue. - :rtype: None - """ - # pylint: disable=protected-access - - # extra post run algorithms - for projection in self._projections: - projection._clear_cache() - - super().run(run_time, sync_time) - for projection in self._projections: - projection._clear_cache() @staticmethod def register_binary_search_path(search_path): From 355d9eac1679a5f9aeb8b7e5ef087273a58de363 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 10:56:56 +0100 Subject: [PATCH 16/47] flake8 --- spynnaker/pyNN/spinnaker.py | 1 - 1 file changed, 1 deletion(-) diff --git a/spynnaker/pyNN/spinnaker.py b/spynnaker/pyNN/spinnaker.py index 1180846544..40b1ebb799 100644 --- a/spynnaker/pyNN/spinnaker.py +++ b/spynnaker/pyNN/spinnaker.py @@ -507,7 +507,6 @@ def stop(self, turn_off_machine=None, clear_routing_tables=None, super().stop(turn_off_machine, clear_routing_tables, clear_tags) self.reset_number_of_neurons_per_core() - @staticmethod def register_binary_search_path(search_path): """ Register an additional binary search path for executables. From 3d775db68c0afd48a29446dda8ef9cd1617ada1b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 11:22:23 +0100 Subject: [PATCH 17/47] exclude spynnaker8 from docs --- doc/source/conf.py | 7 +++---- doc/unfiltered-files.txt | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index d67ebd4e28..0102ff5b22 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -390,7 +390,7 @@ # Automatically called by sphinx at startup def setup(app): # NB: extra dot at end is deliberate! - trim = ("spynnaker.", "spynnaker8.", "spinn_front_end_common.", "pacman.", + trim = ("spynnaker.", "spinn_front_end_common.", "pacman.", "spinnman.", "spinn_machine.", "data_specification.", "spinn_utilities.") @@ -438,6 +438,5 @@ def filtered_files(base, unfiltered_files_filename): apidoc.main([ '-o', _output_dir, ".", # Exclude test and setup code - "spynnaker_integration_tests/*", "unittests/*", "setup.py", - *filtered_files("spynnaker", _unfiltered_files), - *filtered_files("spynnaker8", _unfiltered_files)]) + "spynnaker_integration_tests/*", "unittests/*", "setup.py", "spynnaker8" + *filtered_files("spynnaker", _unfiltered_files)]) diff --git a/doc/unfiltered-files.txt b/doc/unfiltered-files.txt index 5c5bae408c..d41c5aad86 100644 --- a/doc/unfiltered-files.txt +++ b/doc/unfiltered-files.txt @@ -50,6 +50,4 @@ spynnaker/pyNN/utilities/spynnaker_failed_state.py spynnaker/pyNN/utilities/struct.py spynnaker/pyNN/utilities/utility_calls.py spynnaker/pyNN/utilities/variable_cache.py -spynnaker8/spynnaker_plotting.py -spynnaker8/spynnaker8_simulator_interface.py -spynnaker8/utilities/neo_convertor.py +spynnaker/pyNN/spynnaker_plotting.py From fb23b2d759c0333846719e3b039c545a88ccface Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 11:35:01 +0100 Subject: [PATCH 18/47] fix syntax --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 0102ff5b22..611f6a2482 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -438,5 +438,5 @@ def filtered_files(base, unfiltered_files_filename): apidoc.main([ '-o', _output_dir, ".", # Exclude test and setup code - "spynnaker_integration_tests/*", "unittests/*", "setup.py", "spynnaker8" + "spynnaker_integration_tests/*", "unittests/*", "setup.py", "spynnaker8/*", *filtered_files("spynnaker", _unfiltered_files)]) From 05879f9aef5d1c4815c3ba65c0226681deb8dc74 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 11:41:43 +0100 Subject: [PATCH 19/47] Revert "test remove spynakker8 external devices" This reverts commit 32974a97 --- spynnaker8/external_devices/__init__.py | 217 ++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 spynnaker8/external_devices/__init__.py diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py new file mode 100644 index 0000000000..4db1eba6ee --- /dev/null +++ b/spynnaker8/external_devices/__init__.py @@ -0,0 +1,217 @@ +# Copyright (c) 2017-2019 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +This contains functions and classes for handling external devices such as the +PushBot (http://spinnakermanchester.github.io/docs/push_bot/). + +.. note:: + When using external devices, it is normally important to configure your + SpiNNaker system to run in real-time mode, which usually reduces numerical + accuracy to gain performance. +""" +import logging +from spinn_utilities.log import FormatAdapter +from spinnman.messages.eieio import EIEIOType +from spynnaker.pyNN.external_devices_models import ( + ArbitraryFPGADevice, ExternalCochleaDevice, ExternalFPGARetinaDevice, + MunichMotorDevice, MunichRetinaDevice, ExternalDeviceLifControl) +from spynnaker.pyNN.connections import ( + SpynnakerLiveSpikesConnection, SpynnakerPoissonControlConnection) +from spynnaker.pyNN.external_devices_models.push_bot.control import ( + PushBotLifEthernet, PushBotLifSpinnakerLink) +from spynnaker.pyNN.external_devices_models.push_bot.spinnaker_link import ( + PushBotSpiNNakerLinkRetinaDevice, + PushBotSpiNNakerLinkLaserDevice, PushBotSpiNNakerLinkLEDDevice, + PushBotSpiNNakerLinkMotorDevice, PushBotSpiNNakerLinkSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.ethernet import ( + PushBotEthernetLaserDevice, PushBotEthernetLEDDevice, + PushBotEthernetMotorDevice, PushBotEthernetRetinaDevice, + PushBotEthernetSpeakerDevice) +from spynnaker.pyNN.external_devices_models.push_bot.parameters import ( + PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, + PushBotSpeaker, PushBotRetinaViewer) +from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol +from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 + +import spynnaker.pyNN.external_devices as moved_code + +logger = FormatAdapter(logging.getLogger(__name__)) + +# useful functions +add_database_socket_address = moved_code.add_database_socket_address +activate_live_output_to = moved_code.activate_live_output_to +activate_live_output_for = moved_code.activate_live_output_for +add_poisson_live_rate_control = moved_code.add_poisson_live_rate_control + +__all__ = [ + "EIEIOType", + + # General Devices + "ExternalCochleaDevice", "ExternalFPGARetinaDevice", + "MunichRetinaDevice", "MunichMotorDevice", "ArbitraryFPGADevice", + "PushBotRetinaViewer", "ExternalDeviceLifControl", + + # PushBot Parameters + "MunichIoSpiNNakerLinkProtocol", + "PushBotLaser", "PushBotLED", "PushBotMotor", "PushBotSpeaker", + "PushBotRetinaResolution", + + # PushBot Ethernet Parts + "PushBotLifEthernet", "PushBotEthernetLaserDevice", + "PushBotEthernetLEDDevice", "PushBotEthernetMotorDevice", + "PushBotEthernetSpeakerDevice", "PushBotEthernetRetinaDevice", + + # PushBot SpiNNaker Link Parts + "PushBotLifSpinnakerLink", "PushBotSpiNNakerLinkLaserDevice", + "PushBotSpiNNakerLinkLEDDevice", "PushBotSpiNNakerLinkMotorDevice", + "PushBotSpiNNakerLinkSpeakerDevice", "PushBotSpiNNakerLinkRetinaDevice", + + # Connections + "SpynnakerLiveSpikesConnection", + "SpynnakerPoissonControlConnection", + + # Provided functions + "activate_live_output_for", + "activate_live_output_to", + "SpikeInjector", + "register_database_notification_request", + "run_forever", + "add_poisson_live_rate_control" +] + +moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") +logger.warning("For imports from spynnaker8.external_devices see imports in " + "https://github.com/SpiNNakerManchester/sPyNNaker/blob/" + "master/spynnaker8/external_devices/__init__.py") + + +def run_forever(sync_time=0): + """ Supports running forever in PyNN 0.8/0.9 format + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.run_forever(sync_time) + + +def run_sync(run_time, sync_time): + """ Run in steps of the given number of milliseconds pausing between\ + for a signal to be sent from the host + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.run_sync(run_time, sync_time) + + +def continue_simulation(): + """ Continue a synchronised simulation + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.continue_simulation() + + +def request_stop(): + """ Request a stop in the simulation without a complete stop. Will stop\ + after the next auto-pause-and-resume cycle + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.request_stop() + + +def register_database_notification_request(hostname, notify_port, ack_port): + """ Adds a socket system which is registered with the notification protocol + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + moved_code.register_database_notification_request( + hostname, notify_port, ack_port) + + +# Store the connection to be used by multiple users +__ethernet_control_connection = None + + +def EthernetControlPopulation( + n_neurons, model, label=None, local_host=None, local_port=None, + database_notify_port_num=None, database_ack_port_num=None): + """ Create a PyNN population that can be included in a network to\ + control an external device which is connected to the host + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.EthernetControlPopulation( + n_neurons, model, label, local_host, local_port, + database_notify_port_num, database_ack_port_num) + + +def EthernetSensorPopulation( + device, local_host=None, + database_notify_port_num=None, database_ack_port_num=None): + """ Create a pyNN population which can be included in a network to\ + receive spikes from a device connected to the host + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.EthernetSensorPopulation( + device, local_host, database_notify_port_num, database_ack_port_num) + + +def SpikeInjector( + notify=True, database_notify_host=None, database_notify_port_num=None, + database_ack_port_num=None): + """ Supports creating a spike injector that can be added to the\ + application graph. + + .. deprecated:: 6.0 + Use + :py:class:`spynnaker.pyNN.external_devices` instead. + """ + # pylint: disable=too-many-arguments + moved_in_v6("spynnaker8.external_devices", + "spynnaker.pyNN.external_devices") + return moved_code.SpikeInjector( + notify, database_notify_host, database_notify_port_num, + database_ack_port_num) From bbc2c32b2eac87a7b7f58973147612e5dea323b6 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 12:18:50 +0100 Subject: [PATCH 20/47] move extra_models to spynnaker.pynn --- spynnaker/pyNN/extra_models/__init__.py | 51 +++++++++++++++++++ spynnaker8/__init__.py | 2 +- spynnaker8/external_devices/__init__.py | 4 -- spynnaker8/extra_models/__init__.py | 4 ++ .../test_external_devices/test_live_sync.py | 3 +- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 spynnaker/pyNN/extra_models/__init__.py diff --git a/spynnaker/pyNN/extra_models/__init__.py b/spynnaker/pyNN/extra_models/__init__.py new file mode 100644 index 0000000000..077bd606d6 --- /dev/null +++ b/spynnaker/pyNN/extra_models/__init__.py @@ -0,0 +1,51 @@ +# Copyright (c) 2017-2022 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from spynnaker8.models.synapse_dynamics.timing_dependence import ( + TimingDependenceRecurrent as RecurrentRule, + TimingDependenceSpikeNearestPair as SpikeNearestPairRule, + TimingDependenceVogels2011 as Vogels2011Rule, + TimingDependencePfisterSpikeTriplet as PfisterSpikeTriplet) +from spynnaker.pyNN.models.neuron.synapse_dynamics import ( + SynapseDynamicsNeuromodulation as Neuromodulation) +from spynnaker8.models.synapse_dynamics.weight_dependence import ( + WeightDependenceAdditiveTriplet) +from spynnaker.pyNN.models.neuron.builds import ( + IFCondExpStoc, + IFCurrDelta as IFCurDelta, + IFCurrExpCa2Adaptive, + IFCurrDualExpBase as IF_curr_dual_exp, + IzkCondExpBase as Izhikevich_cond, + IFCurrExpSEMDBase as IF_curr_exp_sEMD) + +# Variable rate poisson +from spynnaker.pyNN.models.spike_source import SpikeSourcePoissonVariable + +__all__ = [ + # sPyNNaker models not currently part of full pyNN + 'IFCurDelta', 'IFCurrExpCa2Adaptive', 'IFCondExpStoc', + 'Izhikevich_cond', 'IF_curr_dual_exp', 'IF_curr_exp_sEMD', + + # Neuromodulation synapse dynamics (Mantas Mikaitis) + 'Neuromodulation', + + # sPyNNaker 8 plastic stuff + 'WeightDependenceAdditiveTriplet', + 'PfisterSpikeTriplet', + 'SpikeNearestPairRule', + 'RecurrentRule', 'Vogels2011Rule', + + # Variable rate Poisson + 'SpikeSourcePoissonVariable'] diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 0b3eb2a665..0fe56e1be7 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -107,7 +107,7 @@ from spynnaker.pyNN.models.projection import Projection as SpiNNakerProjection from spynnaker.pyNN import external_devices -from spynnaker8 import extra_models +from spynnaker.pyNN import extra_models # big stuff from spynnaker.pyNN.spinnaker import SpiNNaker diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 4db1eba6ee..5bb0a3240b 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -94,10 +94,6 @@ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") -logger.warning("For imports from spynnaker8.external_devices see imports in " - "https://github.com/SpiNNakerManchester/sPyNNaker/blob/" - "master/spynnaker8/external_devices/__init__.py") - def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format diff --git a/spynnaker8/extra_models/__init__.py b/spynnaker8/extra_models/__init__.py index ecb3489cb9..143ae27f89 100644 --- a/spynnaker8/extra_models/__init__.py +++ b/spynnaker8/extra_models/__init__.py @@ -32,6 +32,7 @@ # Variable rate poisson from spynnaker.pyNN.models.spike_source import SpikeSourcePoissonVariable +from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 __all__ = [ # sPyNNaker 8 models @@ -49,3 +50,6 @@ # Variable rate Poisson 'SpikeSourcePoissonVariable'] + +moved_in_v6("spynnaker8.extra_models", + "spynnaker.pyNN.extra_models") diff --git a/spynnaker_integration_tests/test_external_devices/test_live_sync.py b/spynnaker_integration_tests/test_external_devices/test_live_sync.py index f736fc229e..44ac90d858 100644 --- a/spynnaker_integration_tests/test_external_devices/test_live_sync.py +++ b/spynnaker_integration_tests/test_external_devices/test_live_sync.py @@ -17,6 +17,7 @@ from time import sleep import traceback +from spynnaker8.external_devices import SpynnakerLiveSpikesConnection sim_finished = False n_spikes = list() @@ -61,7 +62,7 @@ def test_live_sync(): """ global sim_finished global n_spikes - conn = p.external_devices.SpynnakerLiveSpikesConnection( + conn = SpynnakerLiveSpikesConnection( receive_labels=["ssa"], local_port=None) conn.add_receive_callback("ssa", recv) conn.add_start_resume_callback("ssa", send_sync) From 328faef721634b8bf0a2b1bd9b364b5ff095ad55 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 12:57:32 +0100 Subject: [PATCH 21/47] flake8 --- spynnaker8/external_devices/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index 5bb0a3240b..e65ef2b622 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -95,6 +95,7 @@ moved_in_v6("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") + def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format From f7bd30099398ca1c8484539d3165c6e8b95bdd1a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 15:00:57 +0100 Subject: [PATCH 22/47] more moved out of spynnaker8 --- spynnaker/pyNN/__init__.py | 684 +++++++++++++++++++++- spynnaker/pyNN/extra_models/__init__.py | 4 +- spynnaker/pyNN/setup_pynn.py | 60 ++ spynnaker/pyNN/utilities/utility_calls.py | 2 +- spynnaker8/__init__.py | 22 + 5 files changed, 768 insertions(+), 4 deletions(-) create mode 100644 spynnaker/pyNN/setup_pynn.py diff --git a/spynnaker/pyNN/__init__.py b/spynnaker/pyNN/__init__.py index ed084651f8..77d2d744c8 100644 --- a/spynnaker/pyNN/__init__.py +++ b/spynnaker/pyNN/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,689 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +""" +The :py:mod:`spynnaker.pyNN` package contains the front end specifications +and implementation for the PyNN High-level API +(http://neuralensemble.org/trac/PyNN). + +This package contains the profile of that code for PyNN 0.9 +""" + +# common imports +import logging +import numpy as __numpy +from pyNN import common as pynn_common +from pyNN.common import control as _pynn_control +from pyNN.recording import get_io +from pyNN.random import NumpyRNG, RandomDistribution as _PynnRandomDistribution +from pyNN.space import ( + Space, Line, Grid2D, Grid3D, Cuboid, Sphere, RandomStructure) +from pyNN.space import distance as _pynn_distance + +from spinn_utilities.log import FormatAdapter +from spinn_front_end_common.utilities.exceptions import ( + ConfigurationException, SimulatorNotSetupException, + SimulatorShutdownException) +from spinn_front_end_common.utilities import globals_variables + +from spynnaker.pyNN.models.abstract_pynn_model import AbstractPyNNModel + +# connections +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neural_projections.connectors import ( + AllToAllConnector, ArrayConnector, CSAConnector, + DistanceDependentProbabilityConnector, FixedNumberPostConnector, + FixedNumberPreConnector, FixedProbabilityConnector, + FromFileConnector, FromListConnector, IndexBasedProbabilityConnector, + KernelConnector, MultapseConnector as FixedTotalNumberConnector, + OneToOneConnector, SmallWorldConnector) +# synapse structures +from spynnaker.pyNN.models.neuron.synapse_dynamics import ( + SynapseDynamicsStatic as StaticSynapse) + +# plastic stuff +from spynnaker.pyNN.models.neuron.synapse_dynamics import ( + SynapseDynamicsSTDP as + STDPMechanism, SynapseDynamicsStructuralStatic as + StructuralMechanismStatic, SynapseDynamicsStructuralSTDP as + StructuralMechanismSTDP) +from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( + WeightDependenceAdditive as + AdditiveWeightDependence, WeightDependenceMultiplicative as + MultiplicativeWeightDependence) +from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( + TimingDependenceSpikePair as + SpikePairRule) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .partner_selection import ( + LastNeuronSelection, RandomSelection) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .formation import ( + DistanceDependentFormation) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .elimination import ( + RandomByWeightElimination) + +# neuron stuff +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_cond_exp_base import ( + IFCondExpBase as IF_cond_exp) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_exp_base import ( + IFCurrExpBase as IF_curr_exp) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_alpha import ( + IFCurrAlpha as IF_curr_alpha) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_delta import ( + IFCurrDelta as IF_curr_delta) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.izk_curr_exp_base import ( + IzkCurrExpBase as Izhikevich) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.spike_source.spike_source_array import ( + SpikeSourceArray) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.spike_source.spike_source_poisson import ( + SpikeSourcePoisson) + +# pops +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.populations import ( + Assembly, Population, PopulationView) + +# projection +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.projection import Projection as SpiNNakerProjection + +from spynnaker.pyNN import external_devices +from spynnaker.pyNN import extra_models + +# big stuff +from spynnaker.pyNN.spinnaker import SpiNNaker + from spynnaker._version import __version__ # NOQA from spynnaker._version import __version_name__ # NOQA from spynnaker._version import __version_month__ # NOQA from spynnaker._version import __version_year__ # NOQA + + +#: The timestep to use of "auto" is specified as a timestep +SPYNNAKER_AUTO_TIMESTEP = 1.0 + +logger = FormatAdapter(logging.getLogger(__name__)) + +__all__ = [ + # PyNN imports + 'Cuboid', 'distance', 'Grid2D', 'Grid3D', 'Line', 'NumpyRNG', + 'RandomDistribution', 'RandomStructure', 'Space', 'Sphere', + + # connections + 'AllToAllConnector', 'ArrayConnector', 'CSAConnector', + 'DistanceDependentProbabilityConnector', 'FixedNumberPostConnector', + 'FixedNumberPreConnector', 'FixedProbabilityConnector', + 'FromFileConnector', 'FromListConnector', 'IndexBasedProbabilityConnector', + 'FixedTotalNumberConnector', 'KernelConnector', 'OneToOneConnector', + 'SmallWorldConnector', + # synapse structures + 'StaticSynapse', + # plastic stuff + 'STDPMechanism', 'AdditiveWeightDependence', + 'MultiplicativeWeightDependence', 'SpikePairRule', + # Structural plasticity by Petrut Bogdan + 'StructuralMechanismStatic', 'StructuralMechanismSTDP', + 'LastNeuronSelection', 'RandomSelection', + 'DistanceDependentFormation', 'RandomByWeightElimination', + # neuron stuff + 'IF_cond_exp', 'IF_curr_exp', "IF_curr_alpha", "IF_curr_delta", + 'Izhikevich', 'SpikeSourceArray', 'SpikeSourcePoisson', + # pops + 'Assembly', 'Population', 'PopulationView', + # projection + 'SpiNNakerProjection', + # External devices and extra models + 'external_devices', 'extra_models', + # Stuff that we define + 'end', 'setup', 'run', 'run_until', 'run_for', 'num_processes', 'rank', + 'reset', 'set_number_of_neurons_per_core', + 'Projection', + 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', + 'get_max_delay', 'initialize', 'list_standard_models', 'name', + 'record', 'record_v', 'record_gsyn'] + +# Dynamically-extracted operations from PyNN +__pynn = {} + + +class RandomDistribution(_PynnRandomDistribution): + """ Class which defines a next(n) method which returns an array of ``n``\ + random numbers from a given distribution. + + :param str distribution: the name of a random number distribution. + :param parameters_pos: + parameters of the distribution, provided as a tuple. For the correct + ordering, see `random.available_distributions`. + :type parameters_pos: tuple or None + :param rng: the random number generator to use, if a specific one is + desired (e.g., to provide a seed). + :type rng: ~pyNN.random.NumpyRNG or ~pyNN.random.GSLRNG or + ~pyNN.random.NativeRNG or None + :param parameters_named: + parameters of the distribution, provided as keyword arguments. + + Parameters may be provided either through ``parameters_pos`` or through + ``parameters_named``, but not both. All parameters must be provided, there + are no default values. Parameter names are, in general, as used in + Wikipedia. + + Examples:: + + >>> rd = RandomDistribution('uniform', (-70, -50)) + >>> rd = RandomDistribution('normal', mu=0.5, sigma=0.1) + >>> rng = NumpyRNG(seed=8658764) + >>> rd = RandomDistribution('gamma', k=2.0, theta=5.0, rng=rng) + + .. list-table:: Available distributions + :widths: auto + :header-rows: 1 + + * - Name + - Parameters + - Comments + * - ``binomial`` + - ``n``, ``p`` + - + * - ``gamma`` + - ``k``, ``theta`` + - + * - ``exponential`` + - ``beta`` + - + * - ``lognormal`` + - ``mu``, ``sigma`` + - + * - ``normal`` + - ``mu``, ``sigma`` + - + * - ``normal_clipped`` + - ``mu``, ``sigma``, ``low``, ``high`` + - Values outside (``low``, ``high``) are redrawn + * - ``normal_clipped_to_boundary`` + - ``mu``, ``sigma``, ``low``, ``high`` + - Values below/above ``low``/``high`` are set to ``low``/``high`` + * - ``poisson`` + - ``lambda_`` + - Trailing underscore since ``lambda`` is a Python keyword + * - ``uniform`` + - ``low``, ``high`` + - + * - ``uniform_int`` + - ``low``, ``high`` + - Only generates integer values + * - ``vonmises`` + - ``mu``, ``kappa`` + - + """ + + def __repr__(self): + return self.__str__() + + +# Patch the bugs in the PyNN documentation... Ugh! +def distance(src, tgt, mask=None, scale_factor=1.0, offset=0.0, + periodic_boundaries=None): + """ Return the Euclidian distance between two cells. + + :param src: + :param tgt: + :param ~numpy.ndarray mask: + allows only certain dimensions to be considered, e.g.: + * to ignore the z-dimension, use ``mask=array([0,1])`` + * to ignore y, ``mask=array([0,2])`` + * to just consider z-distance, ``mask=array([2])`` + :param float scale_factor: allows for different units in the pre- and + post-position (the post-synaptic position is multiplied by this + quantity). + :param float offset: + :param periodic_boundaries: + """ + return _pynn_distance( + src, tgt, mask, scale_factor, offset, periodic_boundaries) + + +def setup(timestep=_pynn_control.DEFAULT_TIMESTEP, + min_delay=_pynn_control.DEFAULT_MIN_DELAY, + max_delay=None, + graph_label=None, + database_socket_addresses=None, time_scale_factor=None, + n_chips_required=None, n_boards_required=None, **extra_params): + """ The main method needed to be called to make the PyNN 0.8 setup. Needs\ + to be called before any other function + + :param timestep: + the time step of the simulations in micro seconds + if None the cfg value is used + :type timestep: + float or None + :param min_delay: the min delay of the simulation + :type min_delay: float or str + :param max_delay: Ignored and logs a warning if provided + :type max_delay: float or str or None + :param graph_label: the label for the graph + :type graph_label: str or None + :param database_socket_addresses: the sockets used by external devices + for the database notification protocol + :type database_socket_addresses: + iterable(~spinn_utilities.socket_address.SocketAddress) + :param time_scale_factor: multiplicative factor to the machine time step + (does not affect the neuron models accuracy) + :type time_scale_factor: int or None + :param n_chips_required: + Deprecated! Use n_boards_required instead. + Must be None if n_boards_required specified. + :type n_chips_required: int or None + :param n_boards_required: + if you need to be allocated a machine (for spalloc) before building + your graph, then fill this in with a general idea of the number of + boards you need so that the spalloc system can allocate you a machine + big enough for your needs. + :type n_boards_required: int or None + :param extra_params: other keyword argumets used to configure PyNN + :return: MPI rank (always 0 on SpiNNaker) + :rtype: int + :raises ConfigurationException: if both ``n_chips_required`` and + ``n_boards_required`` are used. + """ + # Check for "auto" values + if timestep == "auto": + timestep = SPYNNAKER_AUTO_TIMESTEP + if min_delay == "auto": + min_delay = timestep + if max_delay: + logger.warning( + "max_delay is not supported by sPyNNaker so will be ignored") + + # pylint: disable=too-many-arguments, too-many-function-args + # setup PyNN common stuff + pynn_common.setup(timestep, min_delay, **extra_params) + + # create stuff simulator + if globals_variables.has_simulator(): + logger.warning("Calling setup a second time causes the previous " + "simulator to be stopped and cleared.") + # if already exists, kill and rebuild + try: + globals_variables.get_simulator().clear() + except Exception: # pylint: disable=broad-except + logger.exception("Error forcing previous simulation to clear") + + # add default label if needed + if graph_label is None: + graph_label = "PyNN0.8_graph" + + # create the main object for all stuff related software + SpiNNaker( + database_socket_addresses=database_socket_addresses, + time_scale_factor=time_scale_factor, timestep=timestep, + min_delay=min_delay, graph_label=graph_label, + n_chips_required=n_chips_required, + n_boards_required=n_boards_required) + + # warn about kwargs arguments + if extra_params: + logger.warning("Extra params {} have been applied to the setup " + "command which we do not consider", extra_params) + + # get overloaded functions from PyNN in relation of our simulator object + _create_overloaded_functions(globals_variables.get_simulator()) + + return rank() + + +def name(): + """ Returns the name of the simulator + + :rtype: str + """ + return globals_variables.get_last_simulator().name + + +def Projection( + presynaptic_population, postsynaptic_population, + connector, synapse_type=None, source=None, receptor_type="excitatory", + space=None, label=None): + """ Used to support PEP 8 spelling correctly + + :param presynaptic_population: the source pop + :type presynaptic_population: + ~spynnaker.pyNN.models.populations.Population + :param postsynaptic_population: the dest pop + :type postsynaptic_population: + ~spynnaker.pyNN.models.populations.Population + :param AbstractConnector connector: the connector type + :param AbstractStaticSynapseDynamics synapse_type: the synapse type + :param None source: Unsupported; must be ``None`` + :param str receptor_type: the receptor type + :param space: the space object + :type space: ~pyNN.space.Space or None + :param label: the label + :type label: str or None + :return: a projection object for SpiNNaker + :rtype: ~spynnaker.pyNN.models.projection.Projection + """ + # pylint: disable=too-many-arguments + return SpiNNakerProjection( + pre_synaptic_population=presynaptic_population, + post_synaptic_population=postsynaptic_population, connector=connector, + synapse_type=synapse_type, source=source, receptor_type=receptor_type, + space=space, label=label) + + +def _create_overloaded_functions(spinnaker_simulator): + """ Creates functions that the main PyNN interface supports\ + (given from PyNN) + + :param spinnaker_simulator: the simulator object we use underneath + """ + + # overload the failed ones with now valid ones, now that we're in setup + # phase. + __pynn["run"], __pynn["run_until"] = pynn_common.build_run( + spinnaker_simulator) + + __pynn["get_current_time"], __pynn["get_time_step"], \ + __pynn["get_min_delay"], __pynn["get_max_delay"], \ + __pynn["num_processes"], __pynn["rank"] = \ + pynn_common.build_state_queries(spinnaker_simulator) + + __pynn["reset"] = pynn_common.build_reset(spinnaker_simulator) + __pynn["create"] = pynn_common.build_create(Population) + + __pynn["connect"] = pynn_common.build_connect( + Projection, FixedProbabilityConnector, StaticSynapse) + + __pynn["record"] = pynn_common.build_record(spinnaker_simulator) + + +def end(_=True): + """ Cleans up the SpiNNaker machine and software + + :param _: was named compatible_output, which we don't care about, + so is a non-existent parameter + """ + try: + simulator = globals_variables.get_simulator() + except SimulatorShutdownException: + logger.warning("Second call to end ignored") + return + except SimulatorNotSetupException: + logger.exception("Calling end before setup makes no sense ignoring!") + return + for (population, variables, filename) in \ + simulator.write_on_end: + io = get_io(filename) + population.write_data(io, variables) + simulator.write_on_end = [] + simulator.stop() + + +def record_v(source, filename): + """ Deprecated method for getting voltage.\ + This is not documented in the public facing API. + + .. deprecated:: 5.0 + + :param source: the population / view / assembly to record + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: the neo file to write to + :rtype: None + """ + logger.warning( + "Using record_v is deprecated. Use record('v') function instead") + record(['v'], source, filename) + + +def record_gsyn(source, filename): + """ Deprecated method for getting both types of gsyn.\ + This is not documented in the public facing API + + .. deprecated:: 5.0 + + :param source: the population / view / assembly to record + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: the neo file to write to + """ + logger.warning( + "Using record_gsyn is deprecated. Use record('gsyn_exc') and/or" + " record('gsyn_inh') function instead") + record(['gsyn_exc', 'gsyn_inh'], source, filename) + + +def list_standard_models(): + """ Return a list of all the StandardCellType classes available for this\ + simulator. + + :rtype: list(str) + """ + results = list() + for (key, obj) in globals().items(): + if isinstance(obj, type) and issubclass(obj, AbstractPyNNModel): + results.append(key) + return results + + +def set_number_of_neurons_per_core(neuron_type, max_permitted): + """ Sets a ceiling on the number of neurons of a given type that can be\ + placed on a single core. + + :param type(AbstractPopulationVertex) neuron_type: neuron type + :param int max_permitted: the number to set to + """ + if isinstance(neuron_type, str): + msg = "set_number_of_neurons_per_core call now expects " \ + "neuron_type as a class instead of as a str" + raise ConfigurationException(msg) + simulator = globals_variables.get_simulator() + simulator.set_number_of_neurons_per_core( + neuron_type, max_permitted) + + +# These methods will defer to PyNN methods if a simulator exists + + +def connect(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, + rng=None): + """ Builds a projection + + :param ~spynnaker.pyNN.models.populations.Population pre: source pop + :param ~spynnaker.pyNN.models.populations.Population post: destination pop + :param float weight: weight of the connections + :param float delay: the delay of the connections + :param str receptor_type: excitatory / inhibitory + :param float p: probability + :param ~pyNN.random.NumpyRNG rng: random number generator + """ + # pylint: disable=too-many-arguments + globals_variables.check_simulator() + __pynn["connect"](pre, post, weight, delay, receptor_type, p, rng) + + +def create(cellclass, cellparams=None, n=1): + """ Builds a population with certain params + + :param cellclass: population class + :type cellclass: type or AbstractPyNNModel + :param cellparams: population params. + :param int n: n neurons + :rtype: ~spynnaker.pyNN.models.populations.Population + """ + globals_variables.check_simulator() + return __pynn["create"](cellclass, cellparams, n) + + +def NativeRNG(seed_value): + """ Fixes the random number generator's seed + + :param seed_value: + :type seed_value: int or list(int) or ~numpy.ndarray(int32) + """ + __numpy.random.seed(seed_value) + + +def get_current_time(): + """ Gets the time within the simulation + + :return: returns the current time + """ + globals_variables.check_simulator() + return __pynn["get_current_time"]() + + +def get_min_delay(): + """ The minimum allowed synaptic delay; delays will be clamped to be at\ + least this. + + :return: returns the min delay of the simulation + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["get_min_delay"]() + + +def get_max_delay(): + """ Part of the PyNN api but does not make sense for sPyNNaker as + different Projection, Vertex splitter combination could have different + delays they can support + + Most likely value is timestep * 144 + + :raises NotImplementedError: As there is no system wide max_delay + """ + raise NotImplementedError( + "sPyNNaker does not have a system wide max_delay") + + +def get_time_step(): + """ The integration time step + + :return: get the time step of the simulation (in ms) + :rtype: float + """ + globals_variables.check_simulator() + return float(__pynn["get_time_step"]()) + + +def initialize(cells, **initial_values): + """ Sets cells to be initialised to the given values + + :param cells: the cells to change params on + :type cells: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param initial_values: the params and their values to change + """ + globals_variables.check_simulator() + pynn_common.initialize(cells, **initial_values) + + +def num_processes(): + """ The number of MPI processes. + + .. note:: + Always 1 on SpiNNaker, which doesn't use MPI. + + :return: the number of MPI processes + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["num_processes"]() + + +def rank(): + """ The MPI rank of the current node. + + .. note:: + Always 0 on SpiNNaker, which doesn't use MPI. + + :return: MPI rank + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["rank"]() + + +def record(variables, source, filename, sampling_interval=None, + annotations=None): + """ Sets variables to be recorded. + + :param variables: may be either a single variable name or a list of + variable names. For a given celltype class, celltype.recordable + contains a list of variables that can be recorded for that celltype. + :type variables: str or list(str) + :param source: where to record from + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: file name to write data to + :param sampling_interval: + how often to sample the recording, not ignored so far + :param annotations: the annotations to data writers + :type annotations: dict(str, ...) + :return: neo object + :rtype: ~neo.core.Block + """ + globals_variables.check_simulator() + return __pynn["record"](variables, source, filename, sampling_interval, + annotations) + + +def reset(annotations=None): + """ Resets the simulation to t = 0 + + :param annotations: the annotations to the data objects + :type annotations: dict(str, ...) + :rtype: None + """ + if annotations is None: + annotations = {} + globals_variables.check_simulator() + __pynn["reset"](annotations) + + +def run(simtime, callbacks=None): + """ The run() function advances the simulation for a given number of \ + milliseconds, e.g.: + + :param float simtime: time to run for (in milliseconds) + :param callbacks: callbacks to run + :return: the actual simulation time that the simulation stopped at + :rtype: float + """ + globals_variables.check_simulator() + return __pynn["run"](simtime, callbacks=callbacks) + + +# left here because needs to be done, and no better place to put it +# (ABS don't like it, but will put up with it) +run_for = run + + +def run_until(tstop): + """ Run until a (simulation) time period has completed. + + :param float tstop: the time to stop at (in milliseconds) + :return: the actual simulation time that the simulation stopped at + :rtype: float + """ + globals_variables.check_simulator() + return __pynn["run_until"](tstop) + + +def get_machine(): + """ Get the SpiNNaker machine in use. + + :return: the machine object + :rtype: ~spinn_machine.Machine + """ + globals_variables.check_simulator() + return globals_variables.get_simulator().machine diff --git a/spynnaker/pyNN/extra_models/__init__.py b/spynnaker/pyNN/extra_models/__init__.py index 077bd606d6..ffd25f9456 100644 --- a/spynnaker/pyNN/extra_models/__init__.py +++ b/spynnaker/pyNN/extra_models/__init__.py @@ -13,14 +13,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from spynnaker8.models.synapse_dynamics.timing_dependence import ( +from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( TimingDependenceRecurrent as RecurrentRule, TimingDependenceSpikeNearestPair as SpikeNearestPairRule, TimingDependenceVogels2011 as Vogels2011Rule, TimingDependencePfisterSpikeTriplet as PfisterSpikeTriplet) from spynnaker.pyNN.models.neuron.synapse_dynamics import ( SynapseDynamicsNeuromodulation as Neuromodulation) -from spynnaker8.models.synapse_dynamics.weight_dependence import ( +from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( WeightDependenceAdditiveTriplet) from spynnaker.pyNN.models.neuron.builds import ( IFCondExpStoc, diff --git a/spynnaker/pyNN/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py new file mode 100644 index 0000000000..0e2b5bcf28 --- /dev/null +++ b/spynnaker/pyNN/setup_pynn.py @@ -0,0 +1,60 @@ +# Copyright (c) 2017-2019 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +This script installs sPyNNaker so that it usable as the ``pyNN.spiNNaker`` +module. + +.. note:: + This *modifies* your pyNN installation! +""" + +import os +from distutils.version import StrictVersion as Version # pylint: disable=all +import pyNN + + +def version_satisfies(module, requirement): + """ Perform a version check. This code could be smarter... + """ + return Version(module.__version__) >= Version(requirement) + + +def install_sPyNNaker_into(module): + """ Do the actual installation by creating a package within the given\ + module's implementation. This is very nasty! + """ + spinnaker_dir = os.path.join(os.path.dirname(module.__file__), "spiNNaker") + if not os.path.exists(spinnaker_dir): + os.mkdir(spinnaker_dir) + + spinnaker_init = os.path.join(spinnaker_dir, "__init__.py") + with open(spinnaker_init, "w") as spinn_file: + spinn_file.write("from spynnaker.pyNN import *\n") + + print("Created {}".format(spinnaker_init)) + + +# Check the version; we really want PyNN 0.9 +if not version_satisfies(pyNN, "0.9"): + raise Exception( + "PyNN version {} found; sPyNNaker requires PyNN version 0.9".format( + pyNN.__version__)) + +def setup_pynn(): + # Perform the installation + install_sPyNNaker_into(pyNN) + +setup_pynn() diff --git a/spynnaker/pyNN/utilities/utility_calls.py b/spynnaker/pyNN/utilities/utility_calls.py index c169ea5ab5..37fad05138 100644 --- a/spynnaker/pyNN/utilities/utility_calls.py +++ b/spynnaker/pyNN/utilities/utility_calls.py @@ -357,7 +357,7 @@ def moved_in_v6(old_location, new_location): if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': raise NotImplementedError("Old import: {}".format(old_location)) logger.warning("File {} moved to {}. Please fix your imports. " - "In version 7 this will fail completely." + "In version 8 this will fail completely." "".format(old_location, new_location)) diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 0fe56e1be7..879f6d4db7 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -30,6 +30,8 @@ from pyNN.space import ( Space, Line, Grid2D, Grid3D, Cuboid, Sphere, RandomStructure) from pyNN.space import distance as _pynn_distance + +import traceback from spinn_utilities.log import FormatAdapter from spinn_front_end_common.utilities.exceptions import ( ConfigurationException, SimulatorNotSetupException, @@ -112,6 +114,10 @@ # big stuff from spynnaker.pyNN.spinnaker import SpiNNaker + +from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 +from spynnaker.pyNN.setup_pynn import setup_pynn + #: The timestep to use of "auto" is specified as a timestep SPYNNAKER_AUTO_TIMESTEP = 1.0 @@ -159,6 +165,22 @@ __pynn = {} +def is_pynn_call(): + tr = traceback.extract_stack() + for frame_summary in tr: + if 'pyNN' in frame_summary.filename: + return True + return False + + +if is_pynn_call(): + setup_pynn() + raise Exception("Pynn needed to be setup. Now done. Please try again") +else: + moved_in_v6("spynnaker8.", "spynnaker.pyNN") + logger.warning("The recommended way is to do import pyNN.spinnaker") + + class RandomDistribution(_PynnRandomDistribution): """ Class which defines a next(n) method which returns an array of ``n``\ random numbers from a given distribution. From 2d5c5bc1e91f487c75ee89ebfa35b37c4485463d Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 16:12:56 +0100 Subject: [PATCH 23/47] import pyNN.spiNNaker --- spynnaker_integration_tests/scripts/pattern_spiker.py | 2 +- spynnaker_integration_tests/scripts/synfire_npop_run.py | 2 +- spynnaker_integration_tests/scripts/synfire_runner.py | 2 +- .../test_additional_params_mix.py | 2 +- .../test_additional_params_needed.py | 2 +- .../test_additional_params_not_needed.py | 2 +- .../test_array_connector/test_array_connector.py | 2 +- .../test_run_forever_not_recorded.py | 2 +- .../test_run_forever_recorded/test_run_forever_recorded.py | 2 +- .../test_shorter_run/test_spike_source_array.py | 2 +- .../test_big_connection/test_big_connection.py | 4 ++-- .../test_add_new_projection_with_reset.py | 4 ++-- .../test_change_spike_source_poisson.py | 4 ++-- .../test_initialize.py | 4 ++-- .../test_set_and_reset.py | 4 ++-- .../test_set_toffset.py | 4 ++-- .../test_set_toffset_izk.py | 4 ++-- .../test_synfire_poisson_if_curr_exp_parameter.py | 4 ++-- ..._synfire_poisson_if_curr_exp_parameter_test_second_none.py | 4 ++-- .../test_connectors/test_all_to_all_connector.py | 2 +- .../test_connectors/test_connectors.py | 2 +- .../test_connectors/test_fixed_number_post_connector.py | 2 +- .../test_connectors/test_fixed_number_pre_connector.py | 2 +- .../test_connectors/test_from_list_connector_mixed.py | 2 +- .../test_connectors/test_kernel_connector.py | 2 +- .../test_connectors/test_one_to_one_connector.py | 2 +- .../test_connectors/test_use_projection_get_in_from_list.py | 2 +- spynnaker_integration_tests/test_debug_mode/check_debug.py | 2 +- .../test_external_devices/test_live_neuron_voltage.py | 2 +- .../test_external_devices/test_live_sync.py | 4 ++-- .../test_external_devices/test_multiboard_spike_output.py | 2 +- .../test_external_devices/test_recordable_spike_injector.py | 2 +- .../test_distance_dependent_probability_connector.py | 4 ++-- .../test_distance_dependent_weights_and_delays.py | 4 ++-- .../test_grid_based_connectors/test_small_world_connector.py | 4 ++-- spynnaker_integration_tests/test_ignores/test_ignores.py | 4 ++-- .../test_cores_and_binaries_recording.py | 2 +- .../test_iobuf/test_multirun/test_multirun_with.py | 4 ++-- .../test_iobuf/test_none_but_active_recorded/test_no_cores.py | 2 +- .../test_only_binaries_recording.py | 2 +- .../test_only_cores_recorded/test_only_core_recording.py | 2 +- spynnaker_integration_tests/test_many_boards/__init__.py | 2 +- spynnaker_integration_tests/test_many_boards/many_boards.py | 2 +- .../test_master_pop_merging_with_pop_and_delays_mergable.py | 4 ++-- .../test_java_advanced/test_multi_blob_recording.py | 4 ++-- .../test_python_advanced/test_multi_blob_recording.py | 4 ++-- .../test_multi_call_examples/test_larger_run.py | 4 ++-- .../test_multi_call_examples/test_multi_extract.py | 4 ++-- .../test_multi_call_examples/test_multi_run.py | 4 ++-- .../test_multi_call_examples/test_reset_different.py | 4 ++-- .../test_multi_call_examples/test_reset_higher.py | 4 ++-- .../test_multi_call_examples/test_reset_new_input.py | 2 +- .../test_multi_call_examples/test_reset_new_pop.py | 4 ++-- .../test_multi_call_examples/test_reset_run.py | 4 ++-- .../test_multi_call_examples/test_single_run.py | 2 +- .../test_multi_call_examples/test_smaller_run.py | 2 +- .../test_multi_call_examples/test_stdp_random_run.py | 4 ++-- .../test_set_to_true/test_no_vertices.py | 2 +- .../test_onchip_compressor/many_bitfields.py | 2 +- .../test_onchip_compressor/many_routes.py | 2 +- .../test_onchip_compressor/one_route.py | 2 +- .../test_power_monitoring/test_power_mon.py | 2 +- .../test_large_pop_weight_delay_retrieval.py | 4 ++-- .../test_record_sdram/test_record_no_projections.py | 2 +- .../test_record_no_projections.py | 2 +- .../test_reuse_connector/test_reuse_connector.py | 4 ++-- .../test_reuse_connector_different_pops.py | 4 ++-- .../test_selective_recording/test_recording_on_off.py | 4 ++-- .../test_selective_recording/test_sampling.py | 4 ++-- .../test_selective_recording/test_sampling_by_compare.py | 2 +- .../test_selective_recording/test_thritytwo.py | 4 ++-- .../test_spike_source/test_poisson_spike_source.py | 2 +- .../test_spike_source/test_spike_source_array.py | 2 +- .../test_spike_source/test_variable_rate.py | 2 +- .../test_split_various/test_split_delays.py | 2 +- .../test_split_various/test_split_impossible.py | 2 +- .../test_split_various/test_split_simple.py | 2 +- .../test_split_various/test_split_stdp.py | 2 +- .../test_split_various/test_split_struct.py | 4 ++-- .../test_split_various/test_split_struct_stdp.py | 2 +- .../test_stdp/test_IF_cond_exp_stdp_mad_pair_additive.py | 4 ++-- .../test_stdp/test_IF_cond_exp_stdp_nearest_pair_additive.py | 4 ++-- .../test_stdp/test_STDP_nearest_pair_additive.py | 4 ++-- .../test_stdp/test_STDP_nearest_pair_multiplicative.py | 4 ++-- .../test_stdp/test_STDP_neuromodulation.py | 4 ++-- .../test_stdp/test_STDP_pair_additive.py | 4 ++-- .../test_stdp/test_STDP_pair_multiplicative.py | 4 ++-- .../test_stdp/test_STDP_record_weights.py | 4 ++-- .../test_stdp/test_multiple_stdp_mechs_on_same_neuron.py | 4 ++-- .../test_struct_pl/test_structural_elimination_to_empty.py | 4 ++-- .../test_struct_pl/test_structural_formation_to_full.py | 4 ++-- .../test_struct_pl/test_structural_shared.py | 4 ++-- .../test_struct_pl/test_structural_with_stdp.py | 4 ++-- .../test_struct_pl/test_structural_without_stdp.py | 4 ++-- .../test_synapses/test_synapses_excit_vs_inhib.py | 2 +- .../test_various/test_alltoall_with_delay_extension.py | 2 +- .../test_various/test_alltoone_with_large_weight.py | 2 +- .../test_various/test_bigMultiProcessorSpikeSourcePrint.py | 2 +- .../test_various/test_fixed_number_on_two_cores.py | 2 +- .../test_various/test_from_file_connector_large.py | 2 +- spynnaker_integration_tests/test_various/test_get_machine.py | 2 +- spynnaker_integration_tests/test_various/test_multi_step.py | 4 ++-- .../test_various/test_one_pop_lif_example.py | 4 ++-- .../test_various/test_params_set_as_list.py | 2 +- .../test_various/test_params_using_random_dists.py | 2 +- .../test_various/test_projections_between_runs.py | 4 ++-- .../test_various/test_record_packets_per_timestep.py | 2 +- .../test_various/test_reset_clears_delayed_spike.py | 2 +- .../test_various/test_spike_io_multi_run.py | 2 +- .../test_various/test_spike_source_array_get_data.py | 4 ++-- .../test_various/test_synaptic_expander.py | 2 +- .../test_various/test_synfire_Izhikevich.py | 2 +- .../test_various/test_synfire_if_curr_exp_x6.py | 2 +- .../test_various/test_tiny_with_reset.py | 2 +- spynnaker_integration_tests/test_views/test_views.py | 4 ++-- .../test_without_extra_monitor/__init__.py | 2 +- .../test_without_extra_monitor/test_simple_script.py | 4 ++-- unittests/model_tests/neuron/test_get_max_synapses.py | 2 +- .../test_spike_source/test_spike_source_array_vertex.py | 2 +- unittests/model_tests/neuron/test_synapse_io.py | 2 +- unittests/model_tests/neuron/test_synaptic_manager.py | 2 +- unittests/parameters_test.py | 2 +- unittests/test_from_file_connector.py | 2 +- unittests/test_integration_using_virtual_board/reset.py | 2 +- .../test_SA_neuron_class_no_edge.py | 2 +- .../test_SSP_neuron_class_no_edge.py | 2 +- .../test_create_poissons.py | 2 +- .../test_if_curr_alpha.py | 2 +- .../test_one_pop_lif_example.py | 2 +- .../test_params_set_as_list.py | 2 +- unittests/test_integration_using_virtual_board/test_ssa.py | 2 +- .../test_synfire_Izhikevich.py | 2 +- unittests/test_list_standard_models.py | 2 +- unittests/test_pop_views_assembly/test_getting.py | 2 +- unittests/test_pop_views_assembly/test_idmixin.py | 2 +- unittests/test_pop_views_assembly/test_models.py | 2 +- unittests/test_pop_views_assembly/test_population.py | 2 +- unittests/test_pop_views_assembly/test_record.py | 2 +- unittests/test_pop_views_assembly/test_views.py | 2 +- unittests/test_populations/test_population.py | 2 +- .../test_sata_2_different_boards_no_board_address.py | 2 +- .../test_sata_2_different_boards_valid_board_address.py | 2 +- ...test_spinnaker_link_2_different_boards_no_board_address.py | 2 +- ...t_spinnaker_link_2_different_boards_valid_board_address.py | 2 +- unittests/test_using_virtual_board/test_celltype.py | 2 +- unittests/test_using_virtual_board/test_constraint.py | 2 +- .../test_using_virtual_board/test_debug_mode/test_debug.py | 2 +- .../test_do_not_allow_violate/test_do_not_allow_violate.py | 2 +- .../test_extracting_spikes_when_v_only_set_to_record.py | 2 +- .../test_extracting_v_when_spikes_only_set_to_record.py | 2 +- unittests/test_using_virtual_board/test_failed_state.py | 2 +- .../test_using_virtual_board/test_from_file_connector.py | 2 +- .../test_using_virtual_board/test_from_list_connector.py | 2 +- .../test_index_based_probabliity_connector.py | 2 +- .../test_multiple_stdp_mechs_on_same_neuron.py | 2 +- .../test_using_virtual_board/test_one_to_one_connector.py | 2 +- .../test_using_virtual_board/test_properties_of_projection.py | 2 +- .../test_radial_placer/test_radial_constraint.py | 2 +- unittests/test_using_virtual_board/test_reset_add_pop.py | 2 +- unittests/test_using_virtual_board/test_set_record.py | 2 +- ..._synfire_extracting_spikes_when_nothing_set_to_recorded.py | 2 +- .../test_synfire_extracting_v_when_nothing_set_to_recorded.py | 2 +- unittests/test_virtual_board_no_vertices_supported/test.py | 2 +- unittests/utilities_tests/test_random_ranged.py | 2 +- 164 files changed, 217 insertions(+), 217 deletions(-) diff --git a/spynnaker_integration_tests/scripts/pattern_spiker.py b/spynnaker_integration_tests/scripts/pattern_spiker.py index 02e89c7754..0dfbecb56f 100644 --- a/spynnaker_integration_tests/scripts/pattern_spiker.py +++ b/spynnaker_integration_tests/scripts/pattern_spiker.py @@ -131,7 +131,7 @@ def check(self, pop, simtime, spike_rate=None, spike_rec_indexes=None, """ Main method for algorithm checking """ - import spynnaker8 as sim + import pyNN.spiNNaker as sim ps = PatternSpiker() sim.setup(timestep=1) simtime = 100 diff --git a/spynnaker_integration_tests/scripts/synfire_npop_run.py b/spynnaker_integration_tests/scripts/synfire_npop_run.py index 94c47ce980..929fb9c281 100644 --- a/spynnaker_integration_tests/scripts/synfire_npop_run.py +++ b/spynnaker_integration_tests/scripts/synfire_npop_run.py @@ -19,7 +19,7 @@ Synfirechain-like example """ import numpy -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase.root_test_case import RootTestCase diff --git a/spynnaker_integration_tests/scripts/synfire_runner.py b/spynnaker_integration_tests/scripts/synfire_runner.py index 39a74f10f2..4461344186 100644 --- a/spynnaker_integration_tests/scripts/synfire_runner.py +++ b/spynnaker_integration_tests/scripts/synfire_runner.py @@ -17,7 +17,7 @@ Synfirechain-like example """ from pyNN.random import NumpyRNG -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker8 import IF_curr_exp from spynnaker8 import SpikeSourceArray from spynnaker.pyNN.utilities import neo_convertor diff --git a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_mix.py b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_mix.py index 6ff7581731..cfc14f5fdd 100644 --- a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_mix.py +++ b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_mix.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from testfixtures import LogCapture diff --git a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_needed.py b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_needed.py index 09ee3617be..c50baa0d96 100644 --- a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_needed.py +++ b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_needed.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_not_needed.py b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_not_needed.py index aab76b64f7..2762746850 100644 --- a/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_not_needed.py +++ b/spynnaker_integration_tests/test_additional_params_on_pop_not_recogonised/test_additional_params_not_needed.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from testfixtures import LogCapture diff --git a/spynnaker_integration_tests/test_array_connector/test_array_connector.py b/spynnaker_integration_tests/test_array_connector/test_array_connector.py index 1115b520e9..992b3ee790 100644 --- a/spynnaker_integration_tests/test_array_connector/test_array_connector.py +++ b/spynnaker_integration_tests/test_array_connector/test_array_connector.py @@ -16,7 +16,7 @@ import matplotlib.pyplot as plt import numpy from pyNN.utility.plotting import Figure, Panel -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_not_recorded.py b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_not_recorded.py index e46386ca0c..fea2b257fa 100644 --- a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_not_recorded.py +++ b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_not_recorded.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.database.database_connection import ( DatabaseConnection) from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( diff --git a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_recorded.py b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_recorded.py index c1c65be267..6369c2ec30 100644 --- a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_recorded.py +++ b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_run_forever_recorded/test_run_forever_recorded.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.database.database_connection import ( DatabaseConnection) from spynnaker.pyNN.spynnaker_external_device_plugin_manager import ( diff --git a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_shorter_run/test_spike_source_array.py b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_shorter_run/test_spike_source_array.py index 415dc39172..9859ce1869 100644 --- a/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_shorter_run/test_spike_source_array.py +++ b/spynnaker_integration_tests/test_auto_pause_and_resume_tests/test_shorter_run/test_spike_source_array.py @@ -16,7 +16,7 @@ import random from spinnaker_testbase import BaseTestCase import numpy -import spynnaker8 as sim +import pyNN.spiNNaker as sim class MyTestCase(BaseTestCase): diff --git a/spynnaker_integration_tests/test_big_connection/test_big_connection.py b/spynnaker_integration_tests/test_big_connection/test_big_connection.py index b2637b1fb6..1e5cc5de00 100644 --- a/spynnaker_integration_tests/test_big_connection/test_big_connection.py +++ b/spynnaker_integration_tests/test_big_connection/test_big_connection.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ import random import time from spinn_utilities.config_holder import get_config_bool -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_add_new_projection_with_reset.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_add_new_projection_with_reset.py index 742d906360..ea97639c9b 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_add_new_projection_with_reset.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_add_new_projection_with_reset.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_change_spike_source_poisson.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_change_spike_source_poisson.py index b8130684ca..bed8b44a97 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_change_spike_source_poisson.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_change_spike_source_poisson.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_initialize.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_initialize.py index 92117ce726..83c62a9a41 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_initialize.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_initialize.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_and_reset.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_and_reset.py index 0af9dd451a..5d01abe38c 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_and_reset.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_and_reset.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset.py index 613ec5578c..a20e46921a 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ import numpy import spynnaker.plot_utils as plot_utils -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset_izk.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset_izk.py index 2b3c0f31ea..2da9f2dcb8 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset_izk.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_set_toffset_izk.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ import numpy import spynnaker.plot_utils as plot_utils -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter.py index 0dd3597c2e..ce3d746215 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy import spynnaker.plot_utils as plot_utils -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import SynfireRunner diff --git a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter_test_second_none.py b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter_test_second_none.py index c40c299714..efa4930374 100644 --- a/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter_test_second_none.py +++ b/spynnaker_integration_tests/test_change_neuron_parameters_between_runs/test_synfire_poisson_if_curr_exp_parameter_test_second_none.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ import numpy import spynnaker.spike_checker as spike_checker import spynnaker.plot_utils as plot_utils -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import SynfireRunner diff --git a/spynnaker_integration_tests/test_connectors/test_all_to_all_connector.py b/spynnaker_integration_tests/test_connectors/test_all_to_all_connector.py index 889e3f44af..aca182e9ab 100644 --- a/spynnaker_integration_tests/test_connectors/test_all_to_all_connector.py +++ b/spynnaker_integration_tests/test_connectors/test_all_to_all_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_connectors.py b/spynnaker_integration_tests/test_connectors/test_connectors.py index 228390e06c..37fd31f2eb 100644 --- a/spynnaker_integration_tests/test_connectors/test_connectors.py +++ b/spynnaker_integration_tests/test_connectors/test_connectors.py @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities import globals_variables from spynnaker.pyNN.exceptions import SpynnakerException from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_fixed_number_post_connector.py b/spynnaker_integration_tests/test_connectors/test_fixed_number_post_connector.py index 81b3bf8c3a..a99ec40747 100644 --- a/spynnaker_integration_tests/test_connectors/test_fixed_number_post_connector.py +++ b/spynnaker_integration_tests/test_connectors/test_fixed_number_post_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.exceptions import SpynnakerException from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_fixed_number_pre_connector.py b/spynnaker_integration_tests/test_connectors/test_fixed_number_pre_connector.py index a940e71451..55f56e728c 100644 --- a/spynnaker_integration_tests/test_connectors/test_fixed_number_pre_connector.py +++ b/spynnaker_integration_tests/test_connectors/test_fixed_number_pre_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.exceptions import SpynnakerException from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_from_list_connector_mixed.py b/spynnaker_integration_tests/test_connectors/test_from_list_connector_mixed.py index c133ea0ab8..7c32d6cb0a 100644 --- a/spynnaker_integration_tests/test_connectors/test_from_list_connector_mixed.py +++ b/spynnaker_integration_tests/test_connectors/test_from_list_connector_mixed.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_kernel_connector.py b/spynnaker_integration_tests/test_connectors/test_kernel_connector.py index 0ffa1cb3f3..e29e2562d4 100644 --- a/spynnaker_integration_tests/test_connectors/test_kernel_connector.py +++ b/spynnaker_integration_tests/test_connectors/test_kernel_connector.py @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy as np -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_one_to_one_connector.py b/spynnaker_integration_tests/test_connectors/test_one_to_one_connector.py index 2ac029a687..cba535d425 100644 --- a/spynnaker_integration_tests/test_connectors/test_one_to_one_connector.py +++ b/spynnaker_integration_tests/test_connectors/test_one_to_one_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim import numpy from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_connectors/test_use_projection_get_in_from_list.py b/spynnaker_integration_tests/test_connectors/test_use_projection_get_in_from_list.py index 287187536a..fd89ea0582 100644 --- a/spynnaker_integration_tests/test_connectors/test_use_projection_get_in_from_list.py +++ b/spynnaker_integration_tests/test_connectors/test_use_projection_get_in_from_list.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_debug_mode/check_debug.py b/spynnaker_integration_tests/test_debug_mode/check_debug.py index b9138db84a..ebb12d8f96 100644 --- a/spynnaker_integration_tests/test_debug_mode/check_debug.py +++ b/spynnaker_integration_tests/test_debug_mode/check_debug.py @@ -36,7 +36,7 @@ from spynnaker.pyNN.extra_algorithms.\ spynnaker_neuron_network_specification_report import ( _GRAPH_NAME, _GRAPH_FORMAT) -import spynnaker8 as sim +import pyNN.spiNNaker as sim class CheckDebug(BaseTestCase): diff --git a/spynnaker_integration_tests/test_external_devices/test_live_neuron_voltage.py b/spynnaker_integration_tests/test_external_devices/test_live_neuron_voltage.py index 4f17086fd7..6fa18944ea 100644 --- a/spynnaker_integration_tests/test_external_devices/test_live_neuron_voltage.py +++ b/spynnaker_integration_tests/test_external_devices/test_live_neuron_voltage.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from spynnaker.pyNN.external_devices_models import AbstractEthernetTranslator from spynnaker.pyNN.external_devices_models\ diff --git a/spynnaker_integration_tests/test_external_devices/test_live_sync.py b/spynnaker_integration_tests/test_external_devices/test_live_sync.py index f736fc229e..430f4c5467 100644 --- a/spynnaker_integration_tests/test_external_devices/test_live_sync.py +++ b/spynnaker_integration_tests/test_external_devices/test_live_sync.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 The University of Manchester +# Copyright (c) 2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from time import sleep import traceback diff --git a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py index 815695d3e9..47d6e43a0a 100644 --- a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py +++ b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py @@ -16,7 +16,7 @@ import unittest from unittest import SkipTest from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as p +import pyNN.spiNNaker as p import spynnaker8.external_devices as e from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_external_devices/test_recordable_spike_injector.py b/spynnaker_integration_tests/test_external_devices/test_recordable_spike_injector.py index 8aab75811a..b97466fbf9 100644 --- a/spynnaker_integration_tests/test_external_devices/test_recordable_spike_injector.py +++ b/spynnaker_integration_tests/test_external_devices/test_recordable_spike_injector.py @@ -17,7 +17,7 @@ from random import randint import time import unittest -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_probability_connector.py b/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_probability_connector.py index 06d9f21051..b0617442df 100644 --- a/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_probability_connector.py +++ b/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_probability_connector.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from pyNN.utility.plotting import Figure, Panel import matplotlib.pyplot as plt diff --git a/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_weights_and_delays.py b/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_weights_and_delays.py index a5ea731607..f1d9a206a4 100644 --- a/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_weights_and_delays.py +++ b/spynnaker_integration_tests/test_grid_based_connectors/test_distance_dependent_weights_and_delays.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p import math from spinnaker_testbase import BaseTestCase from pyNN.utility.plotting import Figure, Panel diff --git a/spynnaker_integration_tests/test_grid_based_connectors/test_small_world_connector.py b/spynnaker_integration_tests/test_grid_based_connectors/test_small_world_connector.py index 09e9bb3e19..8e7c18f91a 100644 --- a/spynnaker_integration_tests/test_grid_based_connectors/test_small_world_connector.py +++ b/spynnaker_integration_tests/test_grid_based_connectors/test_small_world_connector.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from pyNN.utility.plotting import Figure, Panel from pyNN.random import NumpyRNG diff --git a/spynnaker_integration_tests/test_ignores/test_ignores.py b/spynnaker_integration_tests/test_ignores/test_ignores.py index d8492f5f88..9068883484 100644 --- a/spynnaker_integration_tests/test_ignores/test_ignores.py +++ b/spynnaker_integration_tests/test_ignores/test_ignores.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ from spinn_utilities.config_holder import set_config from spinnman.processes.get_machine_process import GetMachineProcess from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim def hacked_receive_chip_info(self, scp_read_chip_info_response): diff --git a/spynnaker_integration_tests/test_iobuf/test_cores_and_binaries_recorded/test_cores_and_binaries_recording.py b/spynnaker_integration_tests/test_iobuf/test_cores_and_binaries_recorded/test_cores_and_binaries_recording.py index d7f151e482..aba98d0ae2 100644 --- a/spynnaker_integration_tests/test_iobuf/test_cores_and_binaries_recorded/test_cores_and_binaries_recording.py +++ b/spynnaker_integration_tests/test_iobuf/test_cores_and_binaries_recorded/test_cores_and_binaries_recording.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spinn_front_end_common.utilities import globals_variables from spinn_front_end_common.utility_models import \ diff --git a/spynnaker_integration_tests/test_iobuf/test_multirun/test_multirun_with.py b/spynnaker_integration_tests/test_iobuf/test_multirun/test_multirun_with.py index de856d3514..7e8966d39b 100644 --- a/spynnaker_integration_tests/test_iobuf/test_multirun/test_multirun_with.py +++ b/spynnaker_integration_tests/test_iobuf/test_multirun/test_multirun_with.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ import os from spinn_front_end_common.utilities import globals_variables -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_iobuf/test_none_but_active_recorded/test_no_cores.py b/spynnaker_integration_tests/test_iobuf/test_none_but_active_recorded/test_no_cores.py index ad12628fe6..6ec3ca1313 100644 --- a/spynnaker_integration_tests/test_iobuf/test_none_but_active_recorded/test_no_cores.py +++ b/spynnaker_integration_tests/test_iobuf/test_none_but_active_recorded/test_no_cores.py @@ -18,7 +18,7 @@ """ import os from spinn_front_end_common.utilities import globals_variables -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_iobuf/test_only_binaries_recorded/test_only_binaries_recording.py b/spynnaker_integration_tests/test_iobuf/test_only_binaries_recorded/test_only_binaries_recording.py index 8e99d77086..0f415bdf90 100644 --- a/spynnaker_integration_tests/test_iobuf/test_only_binaries_recorded/test_only_binaries_recording.py +++ b/spynnaker_integration_tests/test_iobuf/test_only_binaries_recorded/test_only_binaries_recording.py @@ -16,7 +16,7 @@ """ Synfirechain-like example """ -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spinn_front_end_common.utilities import globals_variables diff --git a/spynnaker_integration_tests/test_iobuf/test_only_cores_recorded/test_only_core_recording.py b/spynnaker_integration_tests/test_iobuf/test_only_cores_recorded/test_only_core_recording.py index f9bb7c7b39..9ab320508a 100644 --- a/spynnaker_integration_tests/test_iobuf/test_only_cores_recorded/test_only_core_recording.py +++ b/spynnaker_integration_tests/test_iobuf/test_only_cores_recorded/test_only_core_recording.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from pacman.model.constraints.placer_constraints import ChipAndCoreConstraint from spinn_front_end_common.utilities import globals_variables diff --git a/spynnaker_integration_tests/test_many_boards/__init__.py b/spynnaker_integration_tests/test_many_boards/__init__.py index 8b398e6536..69c3840c97 100644 --- a/spynnaker_integration_tests/test_many_boards/__init__.py +++ b/spynnaker_integration_tests/test_many_boards/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/spynnaker_integration_tests/test_many_boards/many_boards.py b/spynnaker_integration_tests/test_many_boards/many_boards.py index f083e380c7..f3a6714e8c 100644 --- a/spynnaker_integration_tests/test_many_boards/many_boards.py +++ b/spynnaker_integration_tests/test_many_boards/many_boards.py @@ -17,7 +17,7 @@ from spinn_utilities.config_holder import get_config_bool from spinn_front_end_common.interface.provenance import ProvenanceReader from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker_integration_tests.scripts import check_data from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_master_pop/test_master_pop_merging_with_pop_and_delays_mergable.py b/spynnaker_integration_tests/test_master_pop/test_master_pop_merging_with_pop_and_delays_mergable.py index cfe0d415c8..82a44d42da 100644 --- a/spynnaker_integration_tests/test_master_pop/test_master_pop_merging_with_pop_and_delays_mergable.py +++ b/spynnaker_integration_tests/test_master_pop/test_master_pop_merging_with_pop_and_delays_mergable.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 The University of Manchester +# Copyright (c) 2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities import FecTimer from spinn_front_end_common.utilities.globals_variables import get_simulator from .key_constraint_adder import KeyConstraintAdder diff --git a/spynnaker_integration_tests/test_multi_blob_recording/test_java_advanced/test_multi_blob_recording.py b/spynnaker_integration_tests/test_multi_blob_recording/test_java_advanced/test_multi_blob_recording.py index 9ab6438834..10f8d9c06b 100644 --- a/spynnaker_integration_tests/test_multi_blob_recording/test_java_advanced/test_multi_blob_recording.py +++ b/spynnaker_integration_tests/test_multi_blob_recording/test_java_advanced/test_multi_blob_recording.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_multi_blob_recording/test_python_advanced/test_multi_blob_recording.py b/spynnaker_integration_tests/test_multi_blob_recording/test_python_advanced/test_multi_blob_recording.py index 9ab6438834..10f8d9c06b 100644 --- a/spynnaker_integration_tests/test_multi_blob_recording/test_python_advanced/test_multi_blob_recording.py +++ b/spynnaker_integration_tests/test_multi_blob_recording/test_python_advanced/test_multi_blob_recording.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_larger_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_larger_run.py index 3f41b5021e..f9090efb02 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_larger_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_larger_run.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_multi_extract.py b/spynnaker_integration_tests/test_multi_call_examples/test_multi_extract.py index e85d5eb1cf..7f5712563b 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_multi_extract.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_multi_extract.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_compare from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_multi_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_multi_run.py index dffbe31265..55ff055912 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_multi_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_multi_run.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_reset_different.py b/spynnaker_integration_tests/test_multi_call_examples/test_reset_different.py index 0b7f25a81d..d851820e3e 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_reset_different.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_reset_different.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_compare from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_reset_higher.py b/spynnaker_integration_tests/test_multi_call_examples/test_reset_higher.py index 0d653ddd97..d5b33ae0a6 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_reset_higher.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_reset_higher.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_compare from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_input.py b/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_input.py index 65d6664cef..4fb057aa6f 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_input.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_input.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_pop.py b/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_pop.py index 4093fd00fe..025585f541 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_pop.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_reset_new_pop.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_reset_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_reset_run.py index 032f2b32e2..2ff3588825 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_reset_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_reset_run.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_compare from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_neuron_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_single_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_single_run.py index c662dd6dae..04f95479eb 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_single_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_single_run.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_smaller_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_smaller_run.py index ddf32b5e53..c85df4da6a 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_smaller_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_smaller_run.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import check_data diff --git a/spynnaker_integration_tests/test_multi_call_examples/test_stdp_random_run.py b/spynnaker_integration_tests/test_multi_call_examples/test_stdp_random_run.py index 69d0a8b84f..510a4f4614 100644 --- a/spynnaker_integration_tests/test_multi_call_examples/test_stdp_random_run.py +++ b/spynnaker_integration_tests/test_multi_call_examples/test_stdp_random_run.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase import numpy diff --git a/spynnaker_integration_tests/test_no_vertices_functionality/test_set_to_true/test_no_vertices.py b/spynnaker_integration_tests/test_no_vertices_functionality/test_set_to_true/test_no_vertices.py index 84d940eabf..40d8bfe7bd 100644 --- a/spynnaker_integration_tests/test_no_vertices_functionality/test_set_to_true/test_no_vertices.py +++ b/spynnaker_integration_tests/test_no_vertices_functionality/test_set_to_true/test_no_vertices.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_onchip_compressor/many_bitfields.py b/spynnaker_integration_tests/test_onchip_compressor/many_bitfields.py index 786f40c3a1..f45bcb7e13 100644 --- a/spynnaker_integration_tests/test_onchip_compressor/many_bitfields.py +++ b/spynnaker_integration_tests/test_onchip_compressor/many_bitfields.py @@ -15,7 +15,7 @@ import math from unittest import SkipTest from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexSlice) diff --git a/spynnaker_integration_tests/test_onchip_compressor/many_routes.py b/spynnaker_integration_tests/test_onchip_compressor/many_routes.py index 3728e1b5c0..d2f57c600d 100644 --- a/spynnaker_integration_tests/test_onchip_compressor/many_routes.py +++ b/spynnaker_integration_tests/test_onchip_compressor/many_routes.py @@ -16,7 +16,7 @@ from unittest import SkipTest from spinn_front_end_common.interface.provenance import ProvenanceReader from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexSlice) diff --git a/spynnaker_integration_tests/test_onchip_compressor/one_route.py b/spynnaker_integration_tests/test_onchip_compressor/one_route.py index 6017c0c323..a3272bdac2 100644 --- a/spynnaker_integration_tests/test_onchip_compressor/one_route.py +++ b/spynnaker_integration_tests/test_onchip_compressor/one_route.py @@ -16,7 +16,7 @@ from unittest import SkipTest from spinn_front_end_common.interface.provenance import ProvenanceReader from spynnaker.pyNN.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexSlice) diff --git a/spynnaker_integration_tests/test_power_monitoring/test_power_mon.py b/spynnaker_integration_tests/test_power_monitoring/test_power_mon.py index 6dd47c1d3c..1a19f92603 100644 --- a/spynnaker_integration_tests/test_power_monitoring/test_power_mon.py +++ b/spynnaker_integration_tests/test_power_monitoring/test_power_mon.py @@ -16,7 +16,7 @@ import os import numpy import unittest -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import SynfireRunner from spinn_front_end_common.utilities.globals_variables import ( diff --git a/spynnaker_integration_tests/test_projection_param_retrieval_from_board/test_large_pop_weight_delay_retrieval.py b/spynnaker_integration_tests/test_projection_param_retrieval_from_board/test_large_pop_weight_delay_retrieval.py index 3ea9018f31..699b71bba4 100644 --- a/spynnaker_integration_tests/test_projection_param_retrieval_from_board/test_large_pop_weight_delay_retrieval.py +++ b/spynnaker_integration_tests/test_projection_param_retrieval_from_board/test_large_pop_weight_delay_retrieval.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase import os diff --git a/spynnaker_integration_tests/test_record_sdram/test_record_no_projections.py b/spynnaker_integration_tests/test_record_sdram/test_record_no_projections.py index 487067a84d..5082b58113 100644 --- a/spynnaker_integration_tests/test_record_sdram/test_record_no_projections.py +++ b/spynnaker_integration_tests/test_record_sdram/test_record_no_projections.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_record_sdram_no_extra_mons/test_record_no_projections.py b/spynnaker_integration_tests/test_record_sdram_no_extra_mons/test_record_no_projections.py index 6e9dba0483..5f63f26626 100644 --- a/spynnaker_integration_tests/test_record_sdram_no_extra_mons/test_record_no_projections.py +++ b/spynnaker_integration_tests/test_record_sdram_no_extra_mons/test_record_no_projections.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector.py b/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector.py index 9f32a0f052..a519bb1114 100644 --- a/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector.py +++ b/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector_different_pops.py b/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector_different_pops.py index a1e36316e7..f1b0e518d9 100644 --- a/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector_different_pops.py +++ b/spynnaker_integration_tests/test_reuse_connector/test_reuse_connector_different_pops.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_selective_recording/test_recording_on_off.py b/spynnaker_integration_tests/test_selective_recording/test_recording_on_off.py index f00cf0af7b..26b1f9543b 100644 --- a/spynnaker_integration_tests/test_selective_recording/test_recording_on_off.py +++ b/spynnaker_integration_tests/test_selective_recording/test_recording_on_off.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ from neo.io import PickleIO from spinn_front_end_common.utilities.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_compare from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_selective_recording/test_sampling.py b/spynnaker_integration_tests/test_selective_recording/test_sampling.py index e62df93945..6629ae41a8 100644 --- a/spynnaker_integration_tests/test_selective_recording/test_sampling.py +++ b/spynnaker_integration_tests/test_selective_recording/test_sampling.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spynnaker_integration_tests.scripts import PatternSpiker diff --git a/spynnaker_integration_tests/test_selective_recording/test_sampling_by_compare.py b/spynnaker_integration_tests/test_selective_recording/test_sampling_by_compare.py index 4d4eae7b92..686f4ddd8d 100644 --- a/spynnaker_integration_tests/test_selective_recording/test_sampling_by_compare.py +++ b/spynnaker_integration_tests/test_selective_recording/test_sampling_by_compare.py @@ -16,7 +16,7 @@ import os import sys import numpy -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.models.populations import PopulationView from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_selective_recording/test_thritytwo.py b/spynnaker_integration_tests/test_selective_recording/test_thritytwo.py index e2a9817769..eca1545123 100644 --- a/spynnaker_integration_tests/test_selective_recording/test_thritytwo.py +++ b/spynnaker_integration_tests/test_selective_recording/test_thritytwo.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_spike_source/test_poisson_spike_source.py b/spynnaker_integration_tests/test_spike_source/test_poisson_spike_source.py index 1a12da351b..cc70e7baf0 100644 --- a/spynnaker_integration_tests/test_spike_source/test_poisson_spike_source.py +++ b/spynnaker_integration_tests/test_spike_source/test_poisson_spike_source.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim import math import time from spinn_front_end_common.utilities.exceptions import ConfigurationException diff --git a/spynnaker_integration_tests/test_spike_source/test_spike_source_array.py b/spynnaker_integration_tests/test_spike_source/test_spike_source_array.py index 460cb695eb..4b2b415602 100644 --- a/spynnaker_integration_tests/test_spike_source/test_spike_source_array.py +++ b/spynnaker_integration_tests/test_spike_source/test_spike_source_array.py @@ -16,7 +16,7 @@ import random from spinnaker_testbase import BaseTestCase import numpy -import spynnaker8 as p +import pyNN.spiNNaker as p class TestSpikeSourceArray(BaseTestCase): diff --git a/spynnaker_integration_tests/test_spike_source/test_variable_rate.py b/spynnaker_integration_tests/test_spike_source/test_variable_rate.py index c71b90303c..7fc5fdd4f9 100644 --- a/spynnaker_integration_tests/test_spike_source/test_variable_rate.py +++ b/spynnaker_integration_tests/test_spike_source/test_variable_rate.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase import scipy import numpy diff --git a/spynnaker_integration_tests/test_split_various/test_split_delays.py b/spynnaker_integration_tests/test_split_various/test_split_delays.py index c850d326cd..60f532d4fb 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_delays.py +++ b/spynnaker_integration_tests/test_split_various/test_split_delays.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexNeuronsSynapses) import numpy diff --git a/spynnaker_integration_tests/test_split_various/test_split_impossible.py b/spynnaker_integration_tests/test_split_various/test_split_impossible.py index 5ae09be9fc..9d367775a4 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_impossible.py +++ b/spynnaker_integration_tests/test_split_various/test_split_impossible.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim import pytest from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexNeuronsSynapses) diff --git a/spynnaker_integration_tests/test_split_various/test_split_simple.py b/spynnaker_integration_tests/test_split_various/test_split_simple.py index 78a796a953..3d8e01f79a 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_simple.py +++ b/spynnaker_integration_tests/test_split_various/test_split_simple.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterPoissonDelegate, SplitterAbstractPopulationVertexNeuronsSynapses) from pacman.model.partitioner_splitters import SplitterSliceLegacy diff --git a/spynnaker_integration_tests/test_split_various/test_split_stdp.py b/spynnaker_integration_tests/test_split_various/test_split_stdp.py index cdc6dea8cc..4a60809fd2 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_stdp.py +++ b/spynnaker_integration_tests/test_split_various/test_split_stdp.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_additive_stdp_weight) from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_split_various/test_split_struct.py b/spynnaker_integration_tests/test_split_various/test_split_struct.py index 9de4220394..73a44a3d91 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_struct.py +++ b/spynnaker_integration_tests/test_split_various/test_split_struct.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexNeuronsSynapses) diff --git a/spynnaker_integration_tests/test_split_various/test_split_struct_stdp.py b/spynnaker_integration_tests/test_split_various/test_split_struct_stdp.py index adac7fc4df..789f4e595f 100644 --- a/spynnaker_integration_tests/test_split_various/test_split_struct_stdp.py +++ b/spynnaker_integration_tests/test_split_various/test_split_struct_stdp.py @@ -15,7 +15,7 @@ from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_additive_stdp_weight) from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p import numpy from spynnaker.pyNN.extra_algorithms.splitter_components import ( SplitterAbstractPopulationVertexNeuronsSynapses) diff --git a/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_mad_pair_additive.py b/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_mad_pair_additive.py index 8366b05909..bd919b08ad 100644 --- a/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_mad_pair_additive.py +++ b/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_mad_pair_additive.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ import numpy import unittest -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_additive_stdp_weight) from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_nearest_pair_additive.py b/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_nearest_pair_additive.py index 4fe92a2b0a..7084a202d2 100644 --- a/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_nearest_pair_additive.py +++ b/spynnaker_integration_tests/test_stdp/test_IF_cond_exp_stdp_nearest_pair_additive.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase import numpy import unittest diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_additive.py b/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_additive.py index eb8b0949d6..a4d539c5ec 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_additive.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_additive.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase import numpy import unittest diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_multiplicative.py b/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_multiplicative.py index 5d4a2f12d0..0b3479483b 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_multiplicative.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_nearest_pair_multiplicative.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase import numpy import unittest diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_neuromodulation.py b/spynnaker_integration_tests/test_stdp/test_STDP_neuromodulation.py index 5c6f4cadec..93163b2716 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_neuromodulation.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_neuromodulation.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase import numpy import unittest diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_pair_additive.py b/spynnaker_integration_tests/test_stdp/test_STDP_pair_additive.py index 29103dede6..502d916c02 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_pair_additive.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_pair_additive.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_additive_stdp_weight) from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_pair_multiplicative.py b/spynnaker_integration_tests/test_stdp/test_STDP_pair_multiplicative.py index 345c057509..14214b7300 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_pair_multiplicative.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_pair_multiplicative.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_multiplicative_stdp_weight) from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_stdp/test_STDP_record_weights.py b/spynnaker_integration_tests/test_stdp/test_STDP_record_weights.py index d6bedea3bf..57a5e5a88c 100644 --- a/spynnaker_integration_tests/test_stdp/test_STDP_record_weights.py +++ b/spynnaker_integration_tests/test_stdp/test_STDP_record_weights.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase # Parameters: diff --git a/spynnaker_integration_tests/test_stdp/test_multiple_stdp_mechs_on_same_neuron.py b/spynnaker_integration_tests/test_stdp/test_multiple_stdp_mechs_on_same_neuron.py index 482a03e213..0265bcec8f 100644 --- a/spynnaker_integration_tests/test_stdp/test_multiple_stdp_mechs_on_same_neuron.py +++ b/spynnaker_integration_tests/test_stdp/test_multiple_stdp_mechs_on_same_neuron.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # along with this program. If not, see . from spynnaker.pyNN.exceptions import SynapticConfigurationException -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_struct_pl/test_structural_elimination_to_empty.py b/spynnaker_integration_tests/test_struct_pl/test_structural_elimination_to_empty.py index 6fb3370f7b..cdabecefdf 100644 --- a/spynnaker_integration_tests/test_struct_pl/test_structural_elimination_to_empty.py +++ b/spynnaker_integration_tests/test_struct_pl/test_structural_elimination_to_empty.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p def structural_eliminate_to_empty(): diff --git a/spynnaker_integration_tests/test_struct_pl/test_structural_formation_to_full.py b/spynnaker_integration_tests/test_struct_pl/test_structural_formation_to_full.py index e79d19f057..fe1429bcc7 100644 --- a/spynnaker_integration_tests/test_struct_pl/test_structural_formation_to_full.py +++ b/spynnaker_integration_tests/test_struct_pl/test_structural_formation_to_full.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p def structural_formation_to_full(): diff --git a/spynnaker_integration_tests/test_struct_pl/test_structural_shared.py b/spynnaker_integration_tests/test_struct_pl/test_structural_shared.py index 2b8fb0eaf2..4ec86f28e5 100644 --- a/spynnaker_integration_tests/test_struct_pl/test_structural_shared.py +++ b/spynnaker_integration_tests/test_struct_pl/test_structural_shared.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p import numpy diff --git a/spynnaker_integration_tests/test_struct_pl/test_structural_with_stdp.py b/spynnaker_integration_tests/test_struct_pl/test_structural_with_stdp.py index abae4767cc..29a477bdb7 100644 --- a/spynnaker_integration_tests/test_struct_pl/test_structural_with_stdp.py +++ b/spynnaker_integration_tests/test_struct_pl/test_structural_with_stdp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ from spynnaker.pyNN.models.neuron.synapse_dynamics import ( calculate_spike_pair_additive_stdp_weight) from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p import numpy diff --git a/spynnaker_integration_tests/test_struct_pl/test_structural_without_stdp.py b/spynnaker_integration_tests/test_struct_pl/test_structural_without_stdp.py index df336601fb..6aefd88234 100644 --- a/spynnaker_integration_tests/test_struct_pl/test_structural_without_stdp.py +++ b/spynnaker_integration_tests/test_struct_pl/test_structural_without_stdp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as p +import pyNN.spiNNaker as p def structural_without_stdp(): diff --git a/spynnaker_integration_tests/test_synapses/test_synapses_excit_vs_inhib.py b/spynnaker_integration_tests/test_synapses/test_synapses_excit_vs_inhib.py index 00d273cf1e..beb309e0a7 100644 --- a/spynnaker_integration_tests/test_synapses/test_synapses_excit_vs_inhib.py +++ b/spynnaker_integration_tests/test_synapses/test_synapses_excit_vs_inhib.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_alltoall_with_delay_extension.py b/spynnaker_integration_tests/test_various/test_alltoall_with_delay_extension.py index d776a0ca40..3d27d840ad 100644 --- a/spynnaker_integration_tests/test_various/test_alltoall_with_delay_extension.py +++ b/spynnaker_integration_tests/test_various/test_alltoall_with_delay_extension.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim class AllToAllWithDelayExtensionCase(BaseTestCase): diff --git a/spynnaker_integration_tests/test_various/test_alltoone_with_large_weight.py b/spynnaker_integration_tests/test_various/test_alltoone_with_large_weight.py index 46815552b3..25cd47ac66 100644 --- a/spynnaker_integration_tests/test_various/test_alltoone_with_large_weight.py +++ b/spynnaker_integration_tests/test_various/test_alltoone_with_large_weight.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim class AllToOneWithLargeWeightCase(BaseTestCase): diff --git a/spynnaker_integration_tests/test_various/test_bigMultiProcessorSpikeSourcePrint.py b/spynnaker_integration_tests/test_various/test_bigMultiProcessorSpikeSourcePrint.py index df4dabe47a..e06412c1ce 100644 --- a/spynnaker_integration_tests/test_various/test_bigMultiProcessorSpikeSourcePrint.py +++ b/spynnaker_integration_tests/test_various/test_bigMultiProcessorSpikeSourcePrint.py @@ -16,7 +16,7 @@ # along with this program. If not, see . import spynnaker.plot_utils as plot_utils -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_fixed_number_on_two_cores.py b/spynnaker_integration_tests/test_various/test_fixed_number_on_two_cores.py index 6085fe6458..8b74ff6543 100644 --- a/spynnaker_integration_tests/test_various/test_fixed_number_on_two_cores.py +++ b/spynnaker_integration_tests/test_various/test_fixed_number_on_two_cores.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim class FixNumberOnTwoCoresCase(BaseTestCase): diff --git a/spynnaker_integration_tests/test_various/test_from_file_connector_large.py b/spynnaker_integration_tests/test_various/test_from_file_connector_large.py index d6da65ca96..921e15e350 100644 --- a/spynnaker_integration_tests/test_various/test_from_file_connector_large.py +++ b/spynnaker_integration_tests/test_various/test_from_file_connector_large.py @@ -18,7 +18,7 @@ import random import matplotlib.pyplot as plt from pyNN.utility.plotting import Figure, Panel -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker8.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_get_machine.py b/spynnaker_integration_tests/test_various/test_get_machine.py index d97e49a30f..a24355170c 100644 --- a/spynnaker_integration_tests/test_various/test_get_machine.py +++ b/spynnaker_integration_tests/test_various/test_get_machine.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_multi_step.py b/spynnaker_integration_tests/test_various/test_multi_step.py index 54358de86d..435f6636c8 100644 --- a/spynnaker_integration_tests/test_various/test_multi_step.py +++ b/spynnaker_integration_tests/test_various/test_multi_step.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2020 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p import numpy import sys from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_one_pop_lif_example.py b/spynnaker_integration_tests/test_various/test_one_pop_lif_example.py index 03057f56e5..286c8c1d2a 100644 --- a/spynnaker_integration_tests/test_various/test_one_pop_lif_example.py +++ b/spynnaker_integration_tests/test_various/test_one_pop_lif_example.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_params_set_as_list.py b/spynnaker_integration_tests/test_various/test_params_set_as_list.py index b02bfd86fb..30c811a9e4 100644 --- a/spynnaker_integration_tests/test_various/test_params_set_as_list.py +++ b/spynnaker_integration_tests/test_various/test_params_set_as_list.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from pyNN.random import RandomDistribution, NumpyRNG -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_params_using_random_dists.py b/spynnaker_integration_tests/test_various/test_params_using_random_dists.py index 3e88d59cb1..111d37ae7b 100644 --- a/spynnaker_integration_tests/test_various/test_params_using_random_dists.py +++ b/spynnaker_integration_tests/test_various/test_params_using_random_dists.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from pyNN.random import NumpyRNG -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_projections_between_runs.py b/spynnaker_integration_tests/test_various/test_projections_between_runs.py index d1c7b58f7d..3f9258b0b3 100644 --- a/spynnaker_integration_tests/test_various/test_projections_between_runs.py +++ b/spynnaker_integration_tests/test_various/test_projections_between_runs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase # import neo_convertor diff --git a/spynnaker_integration_tests/test_various/test_record_packets_per_timestep.py b/spynnaker_integration_tests/test_various/test_record_packets_per_timestep.py index eebc512a45..f8df979c27 100644 --- a/spynnaker_integration_tests/test_various/test_record_packets_per_timestep.py +++ b/spynnaker_integration_tests/test_various/test_record_packets_per_timestep.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_reset_clears_delayed_spike.py b/spynnaker_integration_tests/test_various/test_reset_clears_delayed_spike.py index e22565a931..cd720b4280 100644 --- a/spynnaker_integration_tests/test_various/test_reset_clears_delayed_spike.py +++ b/spynnaker_integration_tests/test_various/test_reset_clears_delayed_spike.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_spike_io_multi_run.py b/spynnaker_integration_tests/test_various/test_spike_io_multi_run.py index 230251e639..a355d12214 100644 --- a/spynnaker_integration_tests/test_various/test_spike_io_multi_run.py +++ b/spynnaker_integration_tests/test_various/test_spike_io_multi_run.py @@ -15,7 +15,7 @@ import random from threading import Condition import time -import spynnaker8 as Frontend +import pyNN.spiNNaker as Frontend from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_spike_source_array_get_data.py b/spynnaker_integration_tests/test_various/test_spike_source_array_get_data.py index bbd0bb4569..4684c81911 100644 --- a/spynnaker_integration_tests/test_various/test_spike_source_array_get_data.py +++ b/spynnaker_integration_tests/test_various/test_spike_source_array_get_data.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_synaptic_expander.py b/spynnaker_integration_tests/test_various/test_synaptic_expander.py index 2129d377ff..59a79b583d 100644 --- a/spynnaker_integration_tests/test_various/test_synaptic_expander.py +++ b/spynnaker_integration_tests/test_various/test_synaptic_expander.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnman.exceptions import SpiNNManCoresNotInStateException from spynnaker8 import RandomDistribution import functools diff --git a/spynnaker_integration_tests/test_various/test_synfire_Izhikevich.py b/spynnaker_integration_tests/test_various/test_synfire_Izhikevich.py index adca4f8042..1d180cac58 100644 --- a/spynnaker_integration_tests/test_various/test_synfire_Izhikevich.py +++ b/spynnaker_integration_tests/test_various/test_synfire_Izhikevich.py @@ -20,7 +20,7 @@ """ import spynnaker.plot_utils as plot_utils import spynnaker.spike_checker as spike_checker -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_synfire_if_curr_exp_x6.py b/spynnaker_integration_tests/test_various/test_synfire_if_curr_exp_x6.py index aeadd0fe15..64e1f5eee2 100644 --- a/spynnaker_integration_tests/test_various/test_synfire_if_curr_exp_x6.py +++ b/spynnaker_integration_tests/test_various/test_synfire_if_curr_exp_x6.py @@ -18,7 +18,7 @@ """ Synfirechain-like example with 6 chains """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_various/test_tiny_with_reset.py b/spynnaker_integration_tests/test_various/test_tiny_with_reset.py index 36821d2cca..20e95fbaab 100644 --- a/spynnaker_integration_tests/test_various/test_tiny_with_reset.py +++ b/spynnaker_integration_tests/test_various/test_tiny_with_reset.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_views/test_views.py b/spynnaker_integration_tests/test_views/test_views.py index 21a0e963b2..e474946d94 100644 --- a/spynnaker_integration_tests/test_views/test_views.py +++ b/spynnaker_integration_tests/test_views/test_views.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # along with this program. If not, see . import numpy -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/spynnaker_integration_tests/test_without_extra_monitor/__init__.py b/spynnaker_integration_tests/test_without_extra_monitor/__init__.py index d358f58a86..273f7e64e7 100644 --- a/spynnaker_integration_tests/test_without_extra_monitor/__init__.py +++ b/spynnaker_integration_tests/test_without_extra_monitor/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/spynnaker_integration_tests/test_without_extra_monitor/test_simple_script.py b/spynnaker_integration_tests/test_without_extra_monitor/test_simple_script.py index 8b529c90f3..d515084d28 100644 --- a/spynnaker_integration_tests/test_without_extra_monitor/test_simple_script.py +++ b/spynnaker_integration_tests/test_without_extra_monitor/test_simple_script.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/model_tests/neuron/test_get_max_synapses.py b/unittests/model_tests/neuron/test_get_max_synapses.py index b9316a51c6..799dbf089e 100644 --- a/unittests/model_tests/neuron/test_get_max_synapses.py +++ b/unittests/model_tests/neuron/test_get_max_synapses.py @@ -19,7 +19,7 @@ TimingDependenceSpikePair) from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( WeightDependenceAdditive) -import spynnaker8 +import pyNN.spiNNaker def test_get_max_synapses(): diff --git a/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py b/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py index 4da142d177..18c0cb515c 100644 --- a/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py +++ b/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py @@ -15,7 +15,7 @@ import unittest from spynnaker.pyNN.models.spike_source import SpikeSourceArrayVertex -import spynnaker8 +import pyNN.spiNNaker class TestSpikeSourceArrayVertex(unittest.TestCase): diff --git a/unittests/model_tests/neuron/test_synapse_io.py b/unittests/model_tests/neuron/test_synapse_io.py index fa284f4d6a..3561643835 100644 --- a/unittests/model_tests/neuron/test_synapse_io.py +++ b/unittests/model_tests/neuron/test_synapse_io.py @@ -24,7 +24,7 @@ WeightDependenceAdditive) from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( TimingDependenceSpikePair) -import spynnaker8 +import pyNN.spiNNaker # No unittest_setup as sim.setup must be called before SynapseDynamicsStatic diff --git a/unittests/model_tests/neuron/test_synaptic_manager.py b/unittests/model_tests/neuron/test_synaptic_manager.py index c4a5942a9f..007d97d891 100644 --- a/unittests/model_tests/neuron/test_synaptic_manager.py +++ b/unittests/model_tests/neuron/test_synaptic_manager.py @@ -59,7 +59,7 @@ from spynnaker.pyNN.models.neural_projections.connectors import ( AbstractGenerateConnectorOnMachine) from spynnaker.pyNN.config_setup import unittest_setup -import spynnaker8 as p +import pyNN.spiNNaker as p class MockTransceiverRawData(object): diff --git a/unittests/parameters_test.py b/unittests/parameters_test.py index 656c7a273b..bfcf6fc1ea 100644 --- a/unittests/parameters_test.py +++ b/unittests/parameters_test.py @@ -16,7 +16,7 @@ import unittest from spynnaker.pyNN.config_setup import unittest_setup from spynnaker.pyNN.models.neuron.builds.if_cond_exp_base import IFCondExpBase -import spynnaker8 as p +import pyNN.spiNNaker as p class TestParameters(unittest.TestCase): diff --git a/unittests/test_from_file_connector.py b/unittests/test_from_file_connector.py index 96c8447c90..43bb5a5aae 100644 --- a/unittests/test_from_file_connector.py +++ b/unittests/test_from_file_connector.py @@ -21,7 +21,7 @@ FromFileConnector) from unittests.mocks import MockPopulation from spynnaker.pyNN.models.neural_projections import SynapseInformation -import spynnaker8 +import pyNN.spiNNaker # NO unittest_setup() as sim.setup is called diff --git a/unittests/test_integration_using_virtual_board/reset.py b/unittests/test_integration_using_virtual_board/reset.py index 376ea2614d..1de0a348e2 100644 --- a/unittests/test_integration_using_virtual_board/reset.py +++ b/unittests/test_integration_using_virtual_board/reset.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_SA_neuron_class_no_edge.py b/unittests/test_integration_using_virtual_board/test_SA_neuron_class_no_edge.py index 88e49226b9..673f39cfdd 100644 --- a/unittests/test_integration_using_virtual_board/test_SA_neuron_class_no_edge.py +++ b/unittests/test_integration_using_virtual_board/test_SA_neuron_class_no_edge.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_SSP_neuron_class_no_edge.py b/unittests/test_integration_using_virtual_board/test_SSP_neuron_class_no_edge.py index 60f40db77e..a533befeb2 100644 --- a/unittests/test_integration_using_virtual_board/test_SSP_neuron_class_no_edge.py +++ b/unittests/test_integration_using_virtual_board/test_SSP_neuron_class_no_edge.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_create_poissons.py b/unittests/test_integration_using_virtual_board/test_create_poissons.py index fc805323df..8e3205da30 100644 --- a/unittests/test_integration_using_virtual_board/test_create_poissons.py +++ b/unittests/test_integration_using_virtual_board/test_create_poissons.py @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_if_curr_alpha.py b/unittests/test_integration_using_virtual_board/test_if_curr_alpha.py index f888eefa32..7880607e02 100644 --- a/unittests/test_integration_using_virtual_board/test_if_curr_alpha.py +++ b/unittests/test_integration_using_virtual_board/test_if_curr_alpha.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_one_pop_lif_example.py b/unittests/test_integration_using_virtual_board/test_one_pop_lif_example.py index 6f0813e652..71bc1012a0 100644 --- a/unittests/test_integration_using_virtual_board/test_one_pop_lif_example.py +++ b/unittests/test_integration_using_virtual_board/test_one_pop_lif_example.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_params_set_as_list.py b/unittests/test_integration_using_virtual_board/test_params_set_as_list.py index f4aaaa6adb..ea80914dcc 100644 --- a/unittests/test_integration_using_virtual_board/test_params_set_as_list.py +++ b/unittests/test_integration_using_virtual_board/test_params_set_as_list.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from pyNN.random import RandomDistribution, NumpyRNG -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_ssa.py b/unittests/test_integration_using_virtual_board/test_ssa.py index aa42255499..2cbd5ee15e 100644 --- a/unittests/test_integration_using_virtual_board/test_ssa.py +++ b/unittests/test_integration_using_virtual_board/test_ssa.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_integration_using_virtual_board/test_synfire_Izhikevich.py b/unittests/test_integration_using_virtual_board/test_synfire_Izhikevich.py index 88e239e399..9c6d152ea2 100644 --- a/unittests/test_integration_using_virtual_board/test_synfire_Izhikevich.py +++ b/unittests/test_integration_using_virtual_board/test_synfire_Izhikevich.py @@ -18,7 +18,7 @@ """ Synfirechain-like example """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_list_standard_models.py b/unittests/test_list_standard_models.py index 3100393ef8..7159d60292 100644 --- a/unittests/test_list_standard_models.py +++ b/unittests/test_list_standard_models.py @@ -14,7 +14,7 @@ # along with this program. If not, see . import unittest -import spynnaker8 as sim +import pyNN.spiNNaker as sim class TestListStandardModules(unittest.TestCase): diff --git a/unittests/test_pop_views_assembly/test_getting.py b/unittests/test_pop_views_assembly/test_getting.py index 6e9ff3fda9..78a48d7675 100644 --- a/unittests/test_pop_views_assembly/test_getting.py +++ b/unittests/test_pop_views_assembly/test_getting.py @@ -19,7 +19,7 @@ from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinn_front_end_common.utilities.globals_variables import get_simulator from spynnaker.pyNN.models.recorder import Recorder -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_pop_views_assembly/test_idmixin.py b/unittests/test_pop_views_assembly/test_idmixin.py index 25551f54ac..6ff267b5cd 100644 --- a/unittests/test_pop_views_assembly/test_idmixin.py +++ b/unittests/test_pop_views_assembly/test_idmixin.py @@ -15,7 +15,7 @@ import numpy import pytest -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase N_NEURONS = 4 diff --git a/unittests/test_pop_views_assembly/test_models.py b/unittests/test_pop_views_assembly/test_models.py index 3c03ff4d78..27affa9c0a 100644 --- a/unittests/test_pop_views_assembly/test_models.py +++ b/unittests/test_pop_views_assembly/test_models.py @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_pop_views_assembly/test_population.py b/unittests/test_pop_views_assembly/test_population.py index f04b38fa48..8f6e408c62 100644 --- a/unittests/test_pop_views_assembly/test_population.py +++ b/unittests/test_pop_views_assembly/test_population.py @@ -16,7 +16,7 @@ from unittest import SkipTest import pytest from pyNN.space import Sphere, RandomStructure -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_pop_views_assembly/test_record.py b/unittests/test_pop_views_assembly/test_record.py index 14f0d42b88..0e07968204 100644 --- a/unittests/test_pop_views_assembly/test_record.py +++ b/unittests/test_pop_views_assembly/test_record.py @@ -15,7 +15,7 @@ import pytest from spinn_front_end_common.utilities.exceptions import ConfigurationException -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_pop_views_assembly/test_views.py b/unittests/test_pop_views_assembly/test_views.py index 63c9d4858e..02a8dd0257 100644 --- a/unittests/test_pop_views_assembly/test_views.py +++ b/unittests/test_pop_views_assembly/test_views.py @@ -17,7 +17,7 @@ from pyNN.random import RandomDistribution, NumpyRNG from spinn_front_end_common.utilities.exceptions import ConfigurationException from spynnaker.pyNN.models.populations import PopulationView -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_populations/test_population.py b/unittests/test_populations/test_population.py index b1ef8b798b..c7592dd02d 100644 --- a/unittests/test_populations/test_population.py +++ b/unittests/test_populations/test_population.py @@ -15,7 +15,7 @@ from spynnaker.pyNN.models.neuron.builds import IFCurrExpBase from spynnaker.pyNN.models.populations.population import Population -import spynnaker8 +import pyNN.spiNNaker # NO unittest_step as sim.setup call is needed before creating a Population diff --git a/unittests/test_sata_connectors/test_sata_2_different_boards_no_board_address.py b/unittests/test_sata_connectors/test_sata_2_different_boards_no_board_address.py index 5d0a0666ad..1877ed2991 100644 --- a/unittests/test_sata_connectors/test_sata_2_different_boards_no_board_address.py +++ b/unittests/test_sata_connectors/test_sata_2_different_boards_no_board_address.py @@ -17,7 +17,7 @@ retina example that just feeds data from a retina to live output via an intermediate population """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py b/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py index 06f8008c86..d483e57dc0 100644 --- a/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py +++ b/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py @@ -17,7 +17,7 @@ retina example that just feeds data from a retina to live output via an intermediate population """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_no_board_address.py b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_no_board_address.py index 190724e0e1..d57d4cb46b 100644 --- a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_no_board_address.py +++ b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_no_board_address.py @@ -17,7 +17,7 @@ retina example that just feeds data from a retina to live output via an intermediate population """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py index da792c75c9..a5e026d130 100644 --- a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py +++ b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py @@ -17,7 +17,7 @@ retina example that just feeds data from a retina to live output via an intermediate population """ -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_celltype.py b/unittests/test_using_virtual_board/test_celltype.py index f068831dfe..8f06b39677 100644 --- a/unittests/test_using_virtual_board/test_celltype.py +++ b/unittests/test_using_virtual_board/test_celltype.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_constraint.py b/unittests/test_using_virtual_board/test_constraint.py index 2b6cadfde5..37c3ade034 100644 --- a/unittests/test_using_virtual_board/test_constraint.py +++ b/unittests/test_using_virtual_board/test_constraint.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_debug_mode/test_debug.py b/unittests/test_using_virtual_board/test_debug_mode/test_debug.py index 2d89144d21..cdf67bc152 100644 --- a/unittests/test_using_virtual_board/test_debug_mode/test_debug.py +++ b/unittests/test_using_virtual_board/test_debug_mode/test_debug.py @@ -24,7 +24,7 @@ from spinnaker_testbase import BaseTestCase from spynnaker.pyNN.extra_algorithms.\ spynnaker_neuron_network_specification_report import (_GRAPH_NAME) -import spynnaker8 as sim +import pyNN.spiNNaker as sim class TestDebug(BaseTestCase): diff --git a/unittests/test_using_virtual_board/test_do_not_allow_violate/test_do_not_allow_violate.py b/unittests/test_using_virtual_board/test_do_not_allow_violate/test_do_not_allow_violate.py index e8c7c17721..6c793cb77e 100644 --- a/unittests/test_using_virtual_board/test_do_not_allow_violate/test_do_not_allow_violate.py +++ b/unittests/test_using_virtual_board/test_do_not_allow_violate/test_do_not_allow_violate.py @@ -15,7 +15,7 @@ from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinnaker_testbase import BaseTestCase -import spynnaker8 as sim +import pyNN.spiNNaker as sim class TestDoNotAllowViolate(BaseTestCase): diff --git a/unittests/test_using_virtual_board/test_extracting_spikes_when_v_only_set_to_record.py b/unittests/test_using_virtual_board/test_extracting_spikes_when_v_only_set_to_record.py index 4f2445ffbb..d51e5caf31 100644 --- a/unittests/test_using_virtual_board/test_extracting_spikes_when_v_only_set_to_record.py +++ b/unittests/test_using_virtual_board/test_extracting_spikes_when_v_only_set_to_record.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_extracting_v_when_spikes_only_set_to_record.py b/unittests/test_using_virtual_board/test_extracting_v_when_spikes_only_set_to_record.py index 648a8a9b99..f3a5ee38f9 100644 --- a/unittests/test_using_virtual_board/test_extracting_v_when_spikes_only_set_to_record.py +++ b/unittests/test_using_virtual_board/test_extracting_v_when_spikes_only_set_to_record.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_failed_state.py b/unittests/test_using_virtual_board/test_failed_state.py index 5837e0cc75..a040cd1637 100644 --- a/unittests/test_using_virtual_board/test_failed_state.py +++ b/unittests/test_using_virtual_board/test_failed_state.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase from spinn_front_end_common.utilities.globals_variables import ( setup_for_unittest) diff --git a/unittests/test_using_virtual_board/test_from_file_connector.py b/unittests/test_using_virtual_board/test_from_file_connector.py index 2e79dd318d..f22e7545c2 100644 --- a/unittests/test_using_virtual_board/test_from_file_connector.py +++ b/unittests/test_using_virtual_board/test_from_file_connector.py @@ -15,7 +15,7 @@ import os import numpy -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase import tempfile diff --git a/unittests/test_using_virtual_board/test_from_list_connector.py b/unittests/test_using_virtual_board/test_from_list_connector.py index aab9f91fd0..8af573dc0b 100644 --- a/unittests/test_using_virtual_board/test_from_list_connector.py +++ b/unittests/test_using_virtual_board/test_from_list_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase WEIGHT = 5 diff --git a/unittests/test_using_virtual_board/test_index_based_probabliity_connector.py b/unittests/test_using_virtual_board/test_index_based_probabliity_connector.py index 39b7f8ca45..dfbe780e3d 100644 --- a/unittests/test_using_virtual_board/test_index_based_probabliity_connector.py +++ b/unittests/test_using_virtual_board/test_index_based_probabliity_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase WEIGHT = 5 diff --git a/unittests/test_using_virtual_board/test_multiple_stdp_mechs_on_same_neuron.py b/unittests/test_using_virtual_board/test_multiple_stdp_mechs_on_same_neuron.py index 97e72382fb..e7de19defa 100644 --- a/unittests/test_using_virtual_board/test_multiple_stdp_mechs_on_same_neuron.py +++ b/unittests/test_using_virtual_board/test_multiple_stdp_mechs_on_same_neuron.py @@ -20,7 +20,7 @@ """ import unittest from spynnaker.pyNN.exceptions import SynapticConfigurationException -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_one_to_one_connector.py b/unittests/test_using_virtual_board/test_one_to_one_connector.py index 58f0effee1..326bdc46a7 100644 --- a/unittests/test_using_virtual_board/test_one_to_one_connector.py +++ b/unittests/test_using_virtual_board/test_one_to_one_connector.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_properties_of_projection.py b/unittests/test_using_virtual_board/test_properties_of_projection.py index bb89cf0d7c..7ca8965033 100644 --- a/unittests/test_using_virtual_board/test_properties_of_projection.py +++ b/unittests/test_using_virtual_board/test_properties_of_projection.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_radial_placer/test_radial_constraint.py b/unittests/test_using_virtual_board/test_radial_placer/test_radial_constraint.py index 459ba4e15b..9315a531f8 100644 --- a/unittests/test_using_virtual_board/test_radial_placer/test_radial_constraint.py +++ b/unittests/test_using_virtual_board/test_radial_placer/test_radial_constraint.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from pacman.model.constraints.placer_constraints import ( RadialPlacementFromChipConstraint) from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_reset_add_pop.py b/unittests/test_using_virtual_board/test_reset_add_pop.py index de8a8377a6..f1ed60345d 100644 --- a/unittests/test_using_virtual_board/test_reset_add_pop.py +++ b/unittests/test_using_virtual_board/test_reset_add_pop.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_set_record.py b/unittests/test_using_virtual_board/test_set_record.py index 3d2a921198..a80c011670 100644 --- a/unittests/test_using_virtual_board/test_set_record.py +++ b/unittests/test_using_virtual_board/test_set_record.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from data_specification.enums import DataType from spynnaker.pyNN.models.common import NeuronRecorder -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_synfire_extracting_spikes_when_nothing_set_to_recorded.py b/unittests/test_using_virtual_board/test_synfire_extracting_spikes_when_nothing_set_to_recorded.py index 85c73df529..a7faa8d1b8 100644 --- a/unittests/test_using_virtual_board/test_synfire_extracting_spikes_when_nothing_set_to_recorded.py +++ b/unittests/test_using_virtual_board/test_synfire_extracting_spikes_when_nothing_set_to_recorded.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_using_virtual_board/test_synfire_extracting_v_when_nothing_set_to_recorded.py b/unittests/test_using_virtual_board/test_synfire_extracting_v_when_nothing_set_to_recorded.py index f113d35256..dc9eb5aa9b 100644 --- a/unittests/test_using_virtual_board/test_synfire_extracting_v_when_nothing_set_to_recorded.py +++ b/unittests/test_using_virtual_board/test_synfire_extracting_v_when_nothing_set_to_recorded.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as sim +import pyNN.spiNNaker as sim from spinn_front_end_common.utilities.exceptions import ConfigurationException from spinnaker_testbase import BaseTestCase diff --git a/unittests/test_virtual_board_no_vertices_supported/test.py b/unittests/test_virtual_board_no_vertices_supported/test.py index 1d67c3c6c0..93cc047c9a 100644 --- a/unittests/test_virtual_board_no_vertices_supported/test.py +++ b/unittests/test_virtual_board_no_vertices_supported/test.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase diff --git a/unittests/utilities_tests/test_random_ranged.py b/unittests/utilities_tests/test_random_ranged.py index 139d239d30..5898a377a9 100644 --- a/unittests/utilities_tests/test_random_ranged.py +++ b/unittests/utilities_tests/test_random_ranged.py @@ -15,7 +15,7 @@ from pyNN.random import RandomDistribution from spynnaker.pyNN.utilities.ranged import SpynnakerRangeDictionary -import spynnaker8 as p +import pyNN.spiNNaker as p from spinnaker_testbase import BaseTestCase From 19b19bc59e91537952e11efd556ce504d49abed1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 1 Apr 2022 16:34:10 +0100 Subject: [PATCH 24/47] setup pynn --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 144816903a..9623c70691 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ from setuptools import setup except ImportError: from distutils.core import setup - __version__ = None __version_type__ = None exec(open("spynnaker/_version.py").read()) @@ -77,6 +76,10 @@ def find(main_package): main_package, dirname[start:].replace(os.sep, '.')) package_data[package].append(filename) +def setup_pynn(): + import pyNN + from spynnaker8.setup_pynn import install_sPyNNaker8_into + install_sPyNNaker8_into(pyNN) find("spynnaker") find("spynnaker8") @@ -122,3 +125,4 @@ def find(main_package): maintainer_email="spinnakerusers@googlegroups.com", **long_description ) +setup_pynn() From bfd59e9d6c7f45600edc3cf6e1a0ad3050d2cdd7 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 07:49:40 +0100 Subject: [PATCH 25/47] setup pynn does not work here --- setup.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 9623c70691..144816903a 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ from setuptools import setup except ImportError: from distutils.core import setup + __version__ = None __version_type__ = None exec(open("spynnaker/_version.py").read()) @@ -76,10 +77,6 @@ def find(main_package): main_package, dirname[start:].replace(os.sep, '.')) package_data[package].append(filename) -def setup_pynn(): - import pyNN - from spynnaker8.setup_pynn import install_sPyNNaker8_into - install_sPyNNaker8_into(pyNN) find("spynnaker") find("spynnaker8") @@ -125,4 +122,3 @@ def setup_pynn(): maintainer_email="spinnakerusers@googlegroups.com", **long_description ) -setup_pynn() From 3c4d1f39a9112af1d418b291538b5179edf84b4c Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 08:33:19 +0100 Subject: [PATCH 26/47] setup_pynn --- .github/workflows/python_actions.yml | 3 +- spynnaker/setup_pynn.py | 57 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 spynnaker/setup_pynn.py diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml index a660e9e830..87ecbed4de 100644 --- a/.github/workflows/python_actions.yml +++ b/.github/workflows/python_actions.yml @@ -60,7 +60,8 @@ jobs: uses: ./support/actions/install-matplotlib - name: Setup uses: ./support/actions/run-setup - + with: + setup-pynn: true - name: Create a spynnaker.cfg uses: ./support/actions/configure-spynnaker with: diff --git a/spynnaker/setup_pynn.py b/spynnaker/setup_pynn.py new file mode 100644 index 0000000000..45bfee6553 --- /dev/null +++ b/spynnaker/setup_pynn.py @@ -0,0 +1,57 @@ +# Copyright (c) 2017-2022 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +This script installs sPyNNaker so that it usable as the ``pyNN.spiNNaker`` +module. + +.. note:: + This *modifies* your pyNN installation! +""" + +import os +from distutils.version import StrictVersion as Version # pylint: disable=all +import pyNN + + +def version_satisfies(module, requirement): + """ Perform a version check. This code could be smarter... + """ + return Version(module.__version__) >= Version(requirement) + + +def install_sPyNNaker_into(module): + """ Do the actual installation by creating a package within the given\ + module's implementation. This is very nasty! + """ + spinnaker_dir = os.path.join(os.path.dirname(module.__file__), "spiNNaker") + if not os.path.exists(spinnaker_dir): + os.mkdir(spinnaker_dir) + + spinnaker_init = os.path.join(spinnaker_dir, "pyNN/__init__.py") + with open(spinnaker_init, "w") as spinn_file: + spinn_file.write("from spynnaker.pyNN import *\n") + + print("Created {}".format(spinnaker_init)) + + +# Check the version; we really want PyNN 0.9 +if not version_satisfies(pyNN, "0.9"): + raise Exception( + "PyNN version {} found; sPyNNaker 9 requires PyNN version 0.9".format( + pyNN.__version__)) + +# Perform the installation +install_sPyNNaker_into(pyNN) From 99a98af0ed5c528d1a72cbd14b9b89dff27b684a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 08:59:51 +0100 Subject: [PATCH 27/47] move setup_pynn --- spynnaker/{ => pyNN}/setup_pynn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spynnaker/{ => pyNN}/setup_pynn.py (96%) diff --git a/spynnaker/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py similarity index 96% rename from spynnaker/setup_pynn.py rename to spynnaker/pyNN/setup_pynn.py index 45bfee6553..7473bfc440 100644 --- a/spynnaker/setup_pynn.py +++ b/spynnaker/pyNN/setup_pynn.py @@ -40,7 +40,7 @@ def install_sPyNNaker_into(module): if not os.path.exists(spinnaker_dir): os.mkdir(spinnaker_dir) - spinnaker_init = os.path.join(spinnaker_dir, "pyNN/__init__.py") + spinnaker_init = os.path.join(spinnaker_dir, "__init__.py") with open(spinnaker_init, "w") as spinn_file: spinn_file.write("from spynnaker.pyNN import *\n") From ebf4a6b0531aaad77a840b5c46b6c2f12d7e2d8e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 10:43:26 +0100 Subject: [PATCH 28/47] temporarily point new setuip at spynnaker8 --- spynnaker/pyNN/setup_pynn.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spynnaker/pyNN/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py index 7473bfc440..15dcb0d796 100644 --- a/spynnaker/pyNN/setup_pynn.py +++ b/spynnaker/pyNN/setup_pynn.py @@ -42,7 +42,9 @@ def install_sPyNNaker_into(module): spinnaker_init = os.path.join(spinnaker_dir, "__init__.py") with open(spinnaker_init, "w") as spinn_file: - spinn_file.write("from spynnaker.pyNN import *\n") + # TODO change when spynnaker8 stuff removed. + # spinn_file.write("from spynnaker.pyNN import *\n") + spinn_file.write("from spynnaker8 import *\n") print("Created {}".format(spinnaker_init)) From 308d8909713f572ded8f3c8d971012b39705045b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 10:43:51 +0100 Subject: [PATCH 29/47] fix import to pyNN.spiNNaker --- unittests/model_tests/neuron/test_get_max_synapses.py | 4 ++-- .../test_spike_source/test_spike_source_array_vertex.py | 4 ++-- unittests/model_tests/neuron/test_synapse_io.py | 4 ++-- unittests/test_from_file_connector.py | 4 ++-- unittests/test_populations/test_population.py | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/unittests/model_tests/neuron/test_get_max_synapses.py b/unittests/model_tests/neuron/test_get_max_synapses.py index 799dbf089e..8da699f075 100644 --- a/unittests/model_tests/neuron/test_get_max_synapses.py +++ b/unittests/model_tests/neuron/test_get_max_synapses.py @@ -19,12 +19,12 @@ TimingDependenceSpikePair) from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( WeightDependenceAdditive) -import pyNN.spiNNaker +import pyNN.spiNNaker as sim def test_get_max_synapses(): unittest_setup() - spynnaker8.setup() + sim.setup() d = SynapseDynamicsSTDP(timing_dependence=TimingDependenceSpikePair(), weight_dependence=WeightDependenceAdditive(), pad_to_length=258) diff --git a/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py b/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py index 18c0cb515c..61f17ef6f5 100644 --- a/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py +++ b/unittests/model_tests/neuron/test_spike_source/test_spike_source_array_vertex.py @@ -15,13 +15,13 @@ import unittest from spynnaker.pyNN.models.spike_source import SpikeSourceArrayVertex -import pyNN.spiNNaker +import pyNN.spiNNaker as sim class TestSpikeSourceArrayVertex(unittest.TestCase): def setUp(cls): - spynnaker8.setup() + sim.setup() def test_no_spikes(self): v = SpikeSourceArrayVertex( diff --git a/unittests/model_tests/neuron/test_synapse_io.py b/unittests/model_tests/neuron/test_synapse_io.py index 3561643835..81f2efd28d 100644 --- a/unittests/model_tests/neuron/test_synapse_io.py +++ b/unittests/model_tests/neuron/test_synapse_io.py @@ -24,7 +24,7 @@ WeightDependenceAdditive) from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( TimingDependenceSpikePair) -import pyNN.spiNNaker +import pyNN.spiNNaker as sim # No unittest_setup as sim.setup must be called before SynapseDynamicsStatic @@ -50,7 +50,7 @@ 20, None, 20)]) def test_get_allowed_row_length( dynamics_class, timing, weight, size, exception, max_size): - spynnaker8.setup() + sim.setup() if timing is not None and weight is not None: dynamics = dynamics_class(timing(), weight()) else: diff --git a/unittests/test_from_file_connector.py b/unittests/test_from_file_connector.py index 43bb5a5aae..c0937fc3b5 100644 --- a/unittests/test_from_file_connector.py +++ b/unittests/test_from_file_connector.py @@ -21,7 +21,7 @@ FromFileConnector) from unittests.mocks import MockPopulation from spynnaker.pyNN.models.neural_projections import SynapseInformation -import pyNN.spiNNaker +import pyNN.spiNNaker as sim # NO unittest_setup() as sim.setup is called @@ -55,7 +55,7 @@ def test_connector( clist, column_names, weights, delays, expected_clist, expected_weights, expected_delays, expected_extra_parameters, expected_extra_parameter_names): - spynnaker8.setup() + sim.setup() temp = tempfile.NamedTemporaryFile(delete=False) with temp as f: header = '' diff --git a/unittests/test_populations/test_population.py b/unittests/test_populations/test_population.py index c7592dd02d..f9f8cd2de6 100644 --- a/unittests/test_populations/test_population.py +++ b/unittests/test_populations/test_population.py @@ -15,13 +15,13 @@ from spynnaker.pyNN.models.neuron.builds import IFCurrExpBase from spynnaker.pyNN.models.populations.population import Population -import pyNN.spiNNaker +import pyNN.spiNNaker as sim # NO unittest_step as sim.setup call is needed before creating a Population def test_selector(): - spynnaker8.setup() + sim.setup() model = IFCurrExpBase() pop_1 = Population( size=5, label="Test", constraints=None, cellclass=model, @@ -43,7 +43,7 @@ def test_selector(): def test_round(): - spynnaker8.setup() + sim.setup() model = IFCurrExpBase() pop_1 = Population( size=4.999999, label="Test", cellclass=model, From db815dab61aef1d094ab4684456679dabc2db5b8 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 11:06:41 +0100 Subject: [PATCH 30/47] setup pynn as seperate action --- .github/workflows/python_actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml index 87ecbed4de..be1681ce10 100644 --- a/.github/workflows/python_actions.yml +++ b/.github/workflows/python_actions.yml @@ -60,8 +60,8 @@ jobs: uses: ./support/actions/install-matplotlib - name: Setup uses: ./support/actions/run-setup - with: - setup-pynn: true + - name: Setup PyNN + uses: ./support/actions/pynn-setup - name: Create a spynnaker.cfg uses: ./support/actions/configure-spynnaker with: From 40d26e9e0ba52d5221dbea413c7c0993e76f8a50 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 13:22:43 +0100 Subject: [PATCH 31/47] expose get_machine --- spynnaker8/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index ac082264d5..0a4ac960a5 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -153,7 +153,7 @@ 'Projection', 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', 'get_max_delay', 'initialize', 'list_standard_models', 'name', - 'record', 'record_v', 'record_gsyn'] + 'record', 'record_v', 'record_gsyn', 'get_machine'] # Dynamically-extracted operations from PyNN __pynn = {} From c4fbbd16ec39dd5cd118c138ad1e17e3309ea377 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 11 Apr 2022 16:54:28 +0100 Subject: [PATCH 32/47] flake8 --- spynnaker/pyNN/setup_pynn.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spynnaker/pyNN/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py index 0e2b5bcf28..b7b546243a 100644 --- a/spynnaker/pyNN/setup_pynn.py +++ b/spynnaker/pyNN/setup_pynn.py @@ -53,8 +53,10 @@ def install_sPyNNaker_into(module): "PyNN version {} found; sPyNNaker requires PyNN version 0.9".format( pyNN.__version__)) + def setup_pynn(): # Perform the installation install_sPyNNaker_into(pyNN) + setup_pynn() From 42111b7b80202f6f406fe69c0c13491040e0e37d Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 08:51:25 +0100 Subject: [PATCH 33/47] moved_in_v7 --- spynnaker/pyNN/utilities/utility_calls.py | 18 +++++++++++- spynnaker8/external_devices/__init__.py | 36 +++++++++++------------ spynnaker8/extra_models/__init__.py | 4 +-- spynnaker8/spinnaker.py | 6 ++-- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/spynnaker/pyNN/utilities/utility_calls.py b/spynnaker/pyNN/utilities/utility_calls.py index 856e833a32..59293d8768 100644 --- a/spynnaker/pyNN/utilities/utility_calls.py +++ b/spynnaker/pyNN/utilities/utility_calls.py @@ -355,10 +355,26 @@ def moved_in_v6(old_location, new_location): if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': raise NotImplementedError("Old import: {}".format(old_location)) logger.warning("File {} moved to {}. Please fix your imports. " - "In version 8 this will fail completely." + "In version 7 this will fail completely." "".format(old_location, new_location)) +def moved_in_v7(old_location, new_location): + """ + Warns the users that they are using an old import. + + In version 8 this will be upgraded to a exception and then later removed + + :param str old_location: old import + :param str new_location: new import + :raise: an exception if in CONTINUOUS_INTEGRATION + """ + if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': + raise NotImplementedError("Old import: {}".format(old_location)) + logger.warning("File {} moved to {}. Please fix your imports. " + "In version 8 this will fail completely." + "".format(old_location, new_location)) + def get_time_to_write_us(n_bytes, n_cores): """ Determine how long a write of a given number of bytes will take in us diff --git a/spynnaker8/external_devices/__init__.py b/spynnaker8/external_devices/__init__.py index e65ef2b622..31986c7a18 100644 --- a/spynnaker8/external_devices/__init__.py +++ b/spynnaker8/external_devices/__init__.py @@ -44,7 +44,7 @@ PushBotLaser, PushBotLED, PushBotMotor, PushBotRetinaResolution, PushBotSpeaker, PushBotRetinaViewer) from spynnaker.pyNN.protocols import MunichIoSpiNNakerLinkProtocol -from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 +from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 import spynnaker.pyNN.external_devices as moved_code @@ -92,18 +92,18 @@ "add_poisson_live_rate_control" ] -moved_in_v6("spynnaker8.external_devices", +moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") def run_forever(sync_time=0): """ Supports running forever in PyNN 0.8/0.9 format - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") moved_code.run_forever(sync_time) @@ -112,11 +112,11 @@ def run_sync(run_time, sync_time): """ Run in steps of the given number of milliseconds pausing between\ for a signal to be sent from the host - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") moved_code.run_sync(run_time, sync_time) @@ -124,11 +124,11 @@ def run_sync(run_time, sync_time): def continue_simulation(): """ Continue a synchronised simulation - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") moved_code.continue_simulation() @@ -137,11 +137,11 @@ def request_stop(): """ Request a stop in the simulation without a complete stop. Will stop\ after the next auto-pause-and-resume cycle - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") moved_code.request_stop() @@ -149,11 +149,11 @@ def request_stop(): def register_database_notification_request(hostname, notify_port, ack_port): """ Adds a socket system which is registered with the notification protocol - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") moved_code.register_database_notification_request( hostname, notify_port, ack_port) @@ -169,11 +169,11 @@ def EthernetControlPopulation( """ Create a PyNN population that can be included in a network to\ control an external device which is connected to the host - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") return moved_code.EthernetControlPopulation( n_neurons, model, label, local_host, local_port, @@ -186,11 +186,11 @@ def EthernetSensorPopulation( """ Create a pyNN population which can be included in a network to\ receive spikes from a device connected to the host - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") return moved_code.EthernetSensorPopulation( device, local_host, database_notify_port_num, database_ack_port_num) @@ -202,12 +202,12 @@ def SpikeInjector( """ Supports creating a spike injector that can be added to the\ application graph. - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.external_devices` instead. """ # pylint: disable=too-many-arguments - moved_in_v6("spynnaker8.external_devices", + moved_in_v7("spynnaker8.external_devices", "spynnaker.pyNN.external_devices") return moved_code.SpikeInjector( notify, database_notify_host, database_notify_port_num, diff --git a/spynnaker8/extra_models/__init__.py b/spynnaker8/extra_models/__init__.py index 143ae27f89..c2184b2d62 100644 --- a/spynnaker8/extra_models/__init__.py +++ b/spynnaker8/extra_models/__init__.py @@ -32,7 +32,7 @@ # Variable rate poisson from spynnaker.pyNN.models.spike_source import SpikeSourcePoissonVariable -from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 +from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 __all__ = [ # sPyNNaker 8 models @@ -51,5 +51,5 @@ # Variable rate Poisson 'SpikeSourcePoissonVariable'] -moved_in_v6("spynnaker8.extra_models", +moved_in_v7("spynnaker8.extra_models", "spynnaker.pyNN.extra_models") diff --git a/spynnaker8/spinnaker.py b/spynnaker8/spinnaker.py index 891d0e095f..5fb55e5ac8 100644 --- a/spynnaker8/spinnaker.py +++ b/spynnaker8/spinnaker.py @@ -14,13 +14,13 @@ # along with this program. If not, see . from spynnaker.pyNN.spinnaker import SpiNNaker as _BaseClass -from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 +from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 class SpiNNaker(_BaseClass): """ Main interface for the sPyNNaker implementation of PyNN 0.8/0.9 - .. deprecated:: 6.0 + .. deprecated:: 7.0 Use :py:class:`spynnaker.pyNN.SpiNNaker` instead. """ @@ -30,7 +30,7 @@ def __init__( time_scale_factor, min_delay, graph_label, n_chips_required=None, n_boards_required=None, timestep=0.1): # pylint: disable=too-many-arguments, too-many-locals - moved_in_v6("spynnaker8.spinnaker", + moved_in_v7("spynnaker8.spinnaker", "spynnaker.pyNN.spinnaker") super(SpiNNaker, self).__init__( database_socket_addresses, time_scale_factor, min_delay, From c86e8c365e686f35648e8652d11836170e6f3bdb Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 10:36:08 +0100 Subject: [PATCH 34/47] move code out of spynnaker8 --- spynnaker8/__init__.py | 491 +++++++++++------------------------------ 1 file changed, 125 insertions(+), 366 deletions(-) diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 879f6d4db7..37e61afc7b 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2017-2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,22 +22,14 @@ """ # common imports import logging -import numpy as __numpy from pyNN import common as pynn_common from pyNN.common import control as _pynn_control -from pyNN.recording import get_io -from pyNN.random import NumpyRNG, RandomDistribution as _PynnRandomDistribution +from pyNN.random import NumpyRNG from pyNN.space import ( Space, Line, Grid2D, Grid3D, Cuboid, Sphere, RandomStructure) -from pyNN.space import distance as _pynn_distance import traceback from spinn_utilities.log import FormatAdapter -from spinn_front_end_common.utilities.exceptions import ( - ConfigurationException, SimulatorNotSetupException, - SimulatorShutdownException) -from spinn_front_end_common.utilities import globals_variables -from spynnaker.pyNN.models.abstract_pynn_model import AbstractPyNNModel # connections # noinspection PyUnresolvedReferences @@ -115,8 +107,9 @@ from spynnaker.pyNN.spinnaker import SpiNNaker -from spynnaker.pyNN.utilities.utility_calls import moved_in_v6 +from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 from spynnaker.pyNN.setup_pynn import setup_pynn +import pyNN.spiNNaker as sim #: The timestep to use of "auto" is specified as a timestep SPYNNAKER_AUTO_TIMESTEP = 1.0 @@ -158,8 +151,8 @@ 'reset', 'set_number_of_neurons_per_core', 'Projection', 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', - 'get_max_delay', 'initialize', 'list_standard_models', 'name', - 'record', 'record_v', 'record_gsyn'] + 'initialize', 'list_standard_models', 'name', + 'record'] # Dynamically-extracted operations from PyNN __pynn = {} @@ -173,107 +166,37 @@ def is_pynn_call(): return False +def use_spynnaker_pynn(): + moved_in_v7("spynnaker8", "pyNN.spinnaker which points to spynnaker.pyNN") + + if is_pynn_call(): setup_pynn() raise Exception("Pynn needed to be setup. Now done. Please try again") else: - moved_in_v6("spynnaker8.", "spynnaker.pyNN") - logger.warning("The recommended way is to do import pyNN.spinnaker") + use_spynnaker_pynn() -class RandomDistribution(_PynnRandomDistribution): +class RandomDistribution(sim.RandomDistribution): """ Class which defines a next(n) method which returns an array of ``n``\ random numbers from a given distribution. - :param str distribution: the name of a random number distribution. - :param parameters_pos: - parameters of the distribution, provided as a tuple. For the correct - ordering, see `random.available_distributions`. - :type parameters_pos: tuple or None - :param rng: the random number generator to use, if a specific one is - desired (e.g., to provide a seed). - :type rng: ~pyNN.random.NumpyRNG or ~pyNN.random.GSLRNG or - ~pyNN.random.NativeRNG or None - :param parameters_named: - parameters of the distribution, provided as keyword arguments. - - Parameters may be provided either through ``parameters_pos`` or through - ``parameters_named``, but not both. All parameters must be provided, there - are no default values. Parameter names are, in general, as used in - Wikipedia. - - Examples:: - - >>> rd = RandomDistribution('uniform', (-70, -50)) - >>> rd = RandomDistribution('normal', mu=0.5, sigma=0.1) - >>> rng = NumpyRNG(seed=8658764) - >>> rd = RandomDistribution('gamma', k=2.0, theta=5.0, rng=rng) - - .. list-table:: Available distributions - :widths: auto - :header-rows: 1 - - * - Name - - Parameters - - Comments - * - ``binomial`` - - ``n``, ``p`` - - - * - ``gamma`` - - ``k``, ``theta`` - - - * - ``exponential`` - - ``beta`` - - - * - ``lognormal`` - - ``mu``, ``sigma`` - - - * - ``normal`` - - ``mu``, ``sigma`` - - - * - ``normal_clipped`` - - ``mu``, ``sigma``, ``low``, ``high`` - - Values outside (``low``, ``high``) are redrawn - * - ``normal_clipped_to_boundary`` - - ``mu``, ``sigma``, ``low``, ``high`` - - Values below/above ``low``/``high`` are set to ``low``/``high`` - * - ``poisson`` - - ``lambda_`` - - Trailing underscore since ``lambda`` is a Python keyword - * - ``uniform`` - - ``low``, ``high`` - - - * - ``uniform_int`` - - ``low``, ``high`` - - Only generates integer values - * - ``vonmises`` - - ``mu``, ``kappa`` - - + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - def __repr__(self): - return self.__str__() - -# Patch the bugs in the PyNN documentation... Ugh! def distance(src, tgt, mask=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None): """ Return the Euclidian distance between two cells. - :param src: - :param tgt: - :param ~numpy.ndarray mask: - allows only certain dimensions to be considered, e.g.: - * to ignore the z-dimension, use ``mask=array([0,1])`` - * to ignore y, ``mask=array([0,2])`` - * to just consider z-distance, ``mask=array([2])`` - :param float scale_factor: allows for different units in the pre- and - post-position (the post-synaptic position is multiplied by this - quantity). - :param float offset: - :param periodic_boundaries: + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - return _pynn_distance( + use_spynnaker_pynn() + return sim.distance( src, tgt, mask, scale_factor, offset, periodic_boundaries) @@ -286,92 +209,25 @@ def setup(timestep=_pynn_control.DEFAULT_TIMESTEP, """ The main method needed to be called to make the PyNN 0.8 setup. Needs\ to be called before any other function - :param timestep: - the time step of the simulations in micro seconds - if None the cfg value is used - :type timestep: - float or None - :param min_delay: the min delay of the simulation - :type min_delay: float or str - :param max_delay: Ignored and logs a warning if provided - :type max_delay: float or str or None - :param graph_label: the label for the graph - :type graph_label: str or None - :param database_socket_addresses: the sockets used by external devices - for the database notification protocol - :type database_socket_addresses: - iterable(~spinn_utilities.socket_address.SocketAddress) - :param time_scale_factor: multiplicative factor to the machine time step - (does not affect the neuron models accuracy) - :type time_scale_factor: int or None - :param n_chips_required: - Deprecated! Use n_boards_required instead. - Must be None if n_boards_required specified. - :type n_chips_required: int or None - :param n_boards_required: - if you need to be allocated a machine (for spalloc) before building - your graph, then fill this in with a general idea of the number of - boards you need so that the spalloc system can allocate you a machine - big enough for your needs. - :type n_boards_required: int or None - :param extra_params: other keyword argumets used to configure PyNN - :return: MPI rank (always 0 on SpiNNaker) - :rtype: int - :raises ConfigurationException: if both ``n_chips_required`` and - ``n_boards_required`` are used. + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - # Check for "auto" values - if timestep == "auto": - timestep = SPYNNAKER_AUTO_TIMESTEP - if min_delay == "auto": - min_delay = timestep - if max_delay: - logger.warning( - "max_delay is not supported by sPyNNaker so will be ignored") - - # pylint: disable=too-many-arguments, too-many-function-args - # setup PyNN common stuff - pynn_common.setup(timestep, min_delay, **extra_params) - - # create stuff simulator - if globals_variables.has_simulator(): - logger.warning("Calling setup a second time causes the previous " - "simulator to be stopped and cleared.") - # if already exists, kill and rebuild - try: - globals_variables.get_simulator().clear() - except Exception: # pylint: disable=broad-except - logger.exception("Error forcing previous simulation to clear") - - # add default label if needed - if graph_label is None: - graph_label = "PyNN0.8_graph" - - # create the main object for all stuff related software - SpiNNaker( - database_socket_addresses=database_socket_addresses, - time_scale_factor=time_scale_factor, timestep=timestep, - min_delay=min_delay, graph_label=graph_label, - n_chips_required=n_chips_required, - n_boards_required=n_boards_required) - - # warn about kwargs arguments - if extra_params: - logger.warning("Extra params {} have been applied to the setup " - "command which we do not consider", extra_params) - - # get overloaded functions from PyNN in relation of our simulator object - _create_overloaded_functions(globals_variables.get_simulator()) - - return rank() + use_spynnaker_pynn() + return sim.setup(timestep, min_delay, max_delay, graph_label, + database_socket_addresses, time_scale_factor, + n_chips_required, n_boards_required, **extra_params) def name(): """ Returns the name of the simulator - :rtype: str + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - return globals_variables.get_last_simulator().name + use_spynnaker_pynn() + return sim.name() def Projection( @@ -380,37 +236,26 @@ def Projection( space=None, label=None): """ Used to support PEP 8 spelling correctly - :param presynaptic_population: the source pop - :type presynaptic_population: - ~spynnaker.pyNN.models.populations.Population - :param postsynaptic_population: the dest pop - :type postsynaptic_population: - ~spynnaker.pyNN.models.populations.Population - :param AbstractConnector connector: the connector type - :param AbstractStaticSynapseDynamics synapse_type: the synapse type - :param None source: Unsupported; must be ``None`` - :param str receptor_type: the receptor type - :param space: the space object - :type space: ~pyNN.space.Space or None - :param label: the label - :type label: str or None - :return: a projection object for SpiNNaker - :rtype: ~spynnaker.pyNN.models.projection.Projection + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ # pylint: disable=too-many-arguments - return SpiNNakerProjection( - pre_synaptic_population=presynaptic_population, - post_synaptic_population=postsynaptic_population, connector=connector, - synapse_type=synapse_type, source=source, receptor_type=receptor_type, - space=space, label=label) + use_spynnaker_pynn() + return sim.Projection( + presynaptic_population, postsynaptic_population, connector, + synapse_type, source, receptor_type, space, label) def _create_overloaded_functions(spinnaker_simulator): """ Creates functions that the main PyNN interface supports\ (given from PyNN) - :param spinnaker_simulator: the simulator object we use underneath + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ + use_spynnaker_pynn() # overload the failed ones with now valid ones, now that we're in setup # phase. @@ -434,86 +279,36 @@ def _create_overloaded_functions(spinnaker_simulator): def end(_=True): """ Cleans up the SpiNNaker machine and software - :param _: was named compatible_output, which we don't care about, - so is a non-existent parameter - """ - try: - simulator = globals_variables.get_simulator() - except SimulatorShutdownException: - logger.warning("Second call to end ignored") - return - except SimulatorNotSetupException: - logger.exception("Calling end before setup makes no sense ignoring!") - return - for (population, variables, filename) in \ - simulator.write_on_end: - io = get_io(filename) - population.write_data(io, variables) - simulator.write_on_end = [] - simulator.stop() - - -def record_v(source, filename): - """ Deprecated method for getting voltage.\ - This is not documented in the public facing API. - - .. deprecated:: 5.0 - - :param source: the population / view / assembly to record - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: the neo file to write to - :rtype: None - """ - logger.warning( - "Using record_v is deprecated. Use record('v') function instead") - record(['v'], source, filename) - - -def record_gsyn(source, filename): - """ Deprecated method for getting both types of gsyn.\ - This is not documented in the public facing API - - .. deprecated:: 5.0 - - :param source: the population / view / assembly to record - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: the neo file to write to + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - logger.warning( - "Using record_gsyn is deprecated. Use record('gsyn_exc') and/or" - " record('gsyn_inh') function instead") - record(['gsyn_exc', 'gsyn_inh'], source, filename) + use_spynnaker_pynn() + sim.end() def list_standard_models(): """ Return a list of all the StandardCellType classes available for this\ simulator. - :rtype: list(str) + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - results = list() - for (key, obj) in globals().items(): - if isinstance(obj, type) and issubclass(obj, AbstractPyNNModel): - results.append(key) - return results + use_spynnaker_pynn() + return sim.list_standard_models() def set_number_of_neurons_per_core(neuron_type, max_permitted): """ Sets a ceiling on the number of neurons of a given type that can be\ placed on a single core. - :param type(AbstractPopulationVertex) neuron_type: neuron type - :param int max_permitted: the number to set to + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - if isinstance(neuron_type, str): - msg = "set_number_of_neurons_per_core call now expects " \ - "neuron_type as a class instead of as a str" - raise ConfigurationException(msg) - simulator = globals_variables.get_simulator() - simulator.set_number_of_neurons_per_core( - neuron_type, max_permitted) + use_spynnaker_pynn() + sim.set_number_of_neurons_per_core(neuron_type, max_permitted) # These methods will defer to PyNN methods if a simulator exists @@ -523,170 +318,136 @@ def connect(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, rng=None): """ Builds a projection - :param ~spynnaker.pyNN.models.populations.Population pre: source pop - :param ~spynnaker.pyNN.models.populations.Population post: destination pop - :param float weight: weight of the connections - :param float delay: the delay of the connections - :param str receptor_type: excitatory / inhibitory - :param float p: probability - :param ~pyNN.random.NumpyRNG rng: random number generator + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - # pylint: disable=too-many-arguments - globals_variables.check_simulator() - __pynn["connect"](pre, post, weight, delay, receptor_type, p, rng) + use_spynnaker_pynn() + sim.connect(pre, post, weight, delay, receptor_type, p, rng) def create(cellclass, cellparams=None, n=1): """ Builds a population with certain params - :param cellclass: population class - :type cellclass: type or AbstractPyNNModel - :param cellparams: population params. - :param int n: n neurons - :rtype: ~spynnaker.pyNN.models.populations.Population + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["create"](cellclass, cellparams, n) + use_spynnaker_pynn() + return sim.create(cellclass, cellparams, n) def NativeRNG(seed_value): """ Fixes the random number generator's seed - :param seed_value: - :type seed_value: int or list(int) or ~numpy.ndarray(int32) + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - __numpy.random.seed(seed_value) + use_spynnaker_pynn() + sim.NativeRNG(seed_value) def get_current_time(): """ Gets the time within the simulation - :return: returns the current time + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["get_current_time"]() + use_spynnaker_pynn() + return sim.get_current_time() def get_min_delay(): """ The minimum allowed synaptic delay; delays will be clamped to be at\ least this. - :return: returns the min delay of the simulation - :rtype: int - """ - globals_variables.check_simulator() - return __pynn["get_min_delay"]() - - -def get_max_delay(): - """ Part of the PyNN api but does not make sense for sPyNNaker as - different Projection, Vertex splitter combination could have different - delays they can support - - Most likely value is timestep * 144 - - :raises NotImplementedError: As there is no system wide max_delay + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - raise NotImplementedError( - "sPyNNaker does not have a system wide max_delay") + use_spynnaker_pynn() + return sim.get_min_delay() def get_time_step(): """ The integration time step - :return: get the time step of the simulation (in ms) - :rtype: float + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return float(__pynn["get_time_step"]()) + use_spynnaker_pynn() + return sim.get_time_step() def initialize(cells, **initial_values): """ Sets cells to be initialised to the given values - :param cells: the cells to change params on - :type cells: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param initial_values: the params and their values to change + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - pynn_common.initialize(cells, **initial_values) + use_spynnaker_pynn() + sim.initialize(cells, **initial_values) def num_processes(): """ The number of MPI processes. - .. note:: - Always 1 on SpiNNaker, which doesn't use MPI. - - :return: the number of MPI processes - :rtype: int + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["num_processes"]() + use_spynnaker_pynn() + return sim.num_processes() def rank(): """ The MPI rank of the current node. - .. note:: - Always 0 on SpiNNaker, which doesn't use MPI. - - :return: MPI rank - :rtype: int + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["rank"]() + use_spynnaker_pynn() + return sim.rank() def record(variables, source, filename, sampling_interval=None, annotations=None): """ Sets variables to be recorded. - :param variables: may be either a single variable name or a list of - variable names. For a given celltype class, celltype.recordable - contains a list of variables that can be recorded for that celltype. - :type variables: str or list(str) - :param source: where to record from - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: file name to write data to - :param sampling_interval: - how often to sample the recording, not ignored so far - :param annotations: the annotations to data writers - :type annotations: dict(str, ...) - :return: neo object - :rtype: ~neo.core.Block + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["record"](variables, source, filename, sampling_interval, - annotations) + use_spynnaker_pynn() + sim.record(variables, source, filename, sampling_interval, annotations) def reset(annotations=None): """ Resets the simulation to t = 0 - :param annotations: the annotations to the data objects - :type annotations: dict(str, ...) - :rtype: None + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - if annotations is None: - annotations = {} - globals_variables.check_simulator() - __pynn["reset"](annotations) + use_spynnaker_pynn() + sim.reset(annotations) def run(simtime, callbacks=None): """ The run() function advances the simulation for a given number of \ milliseconds, e.g.: - :param float simtime: time to run for (in milliseconds) - :param callbacks: callbacks to run - :return: the actual simulation time that the simulation stopped at - :rtype: float + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["run"](simtime, callbacks=callbacks) + use_spynnaker_pynn() + return sim.run(simtime, callbacks) # left here because needs to be done, and no better place to put it @@ -697,19 +458,17 @@ def run(simtime, callbacks=None): def run_until(tstop): """ Run until a (simulation) time period has completed. - :param float tstop: the time to stop at (in milliseconds) - :return: the actual simulation time that the simulation stopped at - :rtype: float + .. deprecated:: 7.0 + Use + :py:class:`spynnaker.pyNN` instead. """ - globals_variables.check_simulator() - return __pynn["run_until"](tstop) + use_spynnaker_pynn() + return sim.run_until(tstop) def get_machine(): """ Get the SpiNNaker machine in use. - :return: the machine object - :rtype: ~spinn_machine.Machine """ - globals_variables.check_simulator() - return globals_variables.get_simulator().machine + use_spynnaker_pynn() + return sim.get_machine() From a0d0953f9da9f56b43918e3504e13368c713298e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 10:45:51 +0100 Subject: [PATCH 35/47] moved_in_v6 now errors --- spynnaker/pyNN/utilities/utility_calls.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/spynnaker/pyNN/utilities/utility_calls.py b/spynnaker/pyNN/utilities/utility_calls.py index 59293d8768..f997aa274e 100644 --- a/spynnaker/pyNN/utilities/utility_calls.py +++ b/spynnaker/pyNN/utilities/utility_calls.py @@ -342,21 +342,14 @@ def get_n_bits(n_values): return int(math.ceil(math.log(n_values, 2))) -def moved_in_v6(old_location, new_location): +def moved_in_v6(old_location, _): """ - Warns the users that they are using an old import. - - In version 7 this will be upgraded to a exception and then later removed + Tells the users that old code is no lonfger implemented :param str old_location: old import - :param str new_location: new import - :raise: an exception if in CONTINUOUS_INTEGRATION + :raise: NotImplementedError """ - if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': - raise NotImplementedError("Old import: {}".format(old_location)) - logger.warning("File {} moved to {}. Please fix your imports. " - "In version 7 this will fail completely." - "".format(old_location, new_location)) + raise NotImplementedError("Old import: {}".format(old_location)) def moved_in_v7(old_location, new_location): @@ -375,6 +368,7 @@ def moved_in_v7(old_location, new_location): "In version 8 this will fail completely." "".format(old_location, new_location)) + def get_time_to_write_us(n_bytes, n_cores): """ Determine how long a write of a given number of bytes will take in us From aa060c377ae21722bc11bb906ac76f88c1ddc53e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 10:54:36 +0100 Subject: [PATCH 36/47] flake8 --- spynnaker8/__init__.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 37e61afc7b..769ee56b9b 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -103,10 +103,6 @@ from spynnaker.pyNN import external_devices from spynnaker.pyNN import extra_models -# big stuff -from spynnaker.pyNN.spinnaker import SpiNNaker - - from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 from spynnaker.pyNN.setup_pynn import setup_pynn import pyNN.spiNNaker as sim @@ -214,9 +210,10 @@ def setup(timestep=_pynn_control.DEFAULT_TIMESTEP, :py:class:`spynnaker.pyNN` instead. """ use_spynnaker_pynn() - return sim.setup(timestep, min_delay, max_delay, graph_label, - database_socket_addresses, time_scale_factor, - n_chips_required, n_boards_required, **extra_params) + return sim.setup( + timestep, min_delay, max_delay, graph_label, + database_socket_addresses, time_scale_factor, n_chips_required, + n_boards_required, **extra_params) def name(): From 18e4f6727e5571c1441d9a85b0aa219d3300582a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 11:58:59 +0100 Subject: [PATCH 37/47] add a depreciation redirect hook --- spynnaker/pyNN/abstract_spinnaker_common.py | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 spynnaker/pyNN/abstract_spinnaker_common.py diff --git a/spynnaker/pyNN/abstract_spinnaker_common.py b/spynnaker/pyNN/abstract_spinnaker_common.py new file mode 100644 index 0000000000..7784734adf --- /dev/null +++ b/spynnaker/pyNN/abstract_spinnaker_common.py @@ -0,0 +1,45 @@ +# Copyright (c) 2022 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +The code that used to be here has been merged into SpiNNaker + +This is now just a depreciation redirect hook +""" + +from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 +from spynnaker.pyNN.spinnaker import SpiNNaker + +moved_in_v7("spynnaker.pyNN.abstract_spinnaker_common", + "spynnaker.pyNN.spinnaker") + + +class AbstractSpiNNakerCommon(SpiNNaker): + + def __init__( + self, graph_label, database_socket_addresses, n_chips_required, + n_boards_required, timestep, min_delay, + time_scale_factor=None): + moved_in_v7("spynnaker.pyNN.abstract_spinnaker_common", + "spynnaker.pyNN.spinnaker") + super(database_socket_addresses, + time_scale_factor, min_delay, graph_label, + n_chips_required, n_boards_required, timestep) + + @staticmethod + def register_binary_search_path(search_path): + moved_in_v7("spynnaker.pyNN.abstract_spinnaker_common", + "spynnaker.pyNN.spinnaker") + SpiNNaker.register_binary_search_path(search_path) From 9aa7ca86db6cc35baa9d93fac32b3d86d2676d06 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 13:06:11 +0100 Subject: [PATCH 38/47] remove spynnaker8 import --- .../test_various/test_from_file_connector_large.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker_integration_tests/test_various/test_from_file_connector_large.py b/spynnaker_integration_tests/test_various/test_from_file_connector_large.py index d6da65ca96..a1253d51bb 100644 --- a/spynnaker_integration_tests/test_various/test_from_file_connector_large.py +++ b/spynnaker_integration_tests/test_various/test_from_file_connector_large.py @@ -19,7 +19,7 @@ import matplotlib.pyplot as plt from pyNN.utility.plotting import Figure, Panel import spynnaker8 as p -from spynnaker8.utilities import neo_convertor +from spynnaker.pyNN.utilities import neo_convertor from spinnaker_testbase import BaseTestCase From d4870d602b4d7a5915d63d18b70df0037812afa1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 13:06:35 +0100 Subject: [PATCH 39/47] add get_machine to all --- spynnaker/pyNN/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker/pyNN/__init__.py b/spynnaker/pyNN/__init__.py index 77d2d744c8..63ad7d01ce 100644 --- a/spynnaker/pyNN/__init__.py +++ b/spynnaker/pyNN/__init__.py @@ -161,7 +161,7 @@ 'Projection', 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', 'get_max_delay', 'initialize', 'list_standard_models', 'name', - 'record', 'record_v', 'record_gsyn'] + 'record', 'record_v', 'record_gsyn', "get_machine"] # Dynamically-extracted operations from PyNN __pynn = {} From d50cdd650601c7e6932a9116d70d1404ccf5ca3b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 13:26:08 +0100 Subject: [PATCH 40/47] flake8 --- spynnaker/pyNN/abstract_spinnaker_common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spynnaker/pyNN/abstract_spinnaker_common.py b/spynnaker/pyNN/abstract_spinnaker_common.py index 7784734adf..558fa645d5 100644 --- a/spynnaker/pyNN/abstract_spinnaker_common.py +++ b/spynnaker/pyNN/abstract_spinnaker_common.py @@ -35,8 +35,8 @@ def __init__( moved_in_v7("spynnaker.pyNN.abstract_spinnaker_common", "spynnaker.pyNN.spinnaker") super(database_socket_addresses, - time_scale_factor, min_delay, graph_label, - n_chips_required, n_boards_required, timestep) + time_scale_factor, min_delay, graph_label, + n_chips_required, n_boards_required, timestep) @staticmethod def register_binary_search_path(search_path): From f29a67de1676f1dfcf8f7dbf2b3ef52ed98685af Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 12 Apr 2022 15:12:43 +0100 Subject: [PATCH 41/47] dont go via pyNN.spiNNaker --- spynnaker8/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spynnaker8/__init__.py b/spynnaker8/__init__.py index 769ee56b9b..506e59f5fb 100644 --- a/spynnaker8/__init__.py +++ b/spynnaker8/__init__.py @@ -105,7 +105,7 @@ from spynnaker.pyNN.utilities.utility_calls import moved_in_v7 from spynnaker.pyNN.setup_pynn import setup_pynn -import pyNN.spiNNaker as sim +import spynnaker.pyNN as sim #: The timestep to use of "auto" is specified as a timestep SPYNNAKER_AUTO_TIMESTEP = 1.0 From f2f8a48a64de9e57089cfee2d3f45b304a3bf80a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 09:06:36 +0100 Subject: [PATCH 42/47] file missing from merge --- spynnaker/pyNN/__init__.py | 701 ------------------------------------- 1 file changed, 701 deletions(-) delete mode 100644 spynnaker/pyNN/__init__.py diff --git a/spynnaker/pyNN/__init__.py b/spynnaker/pyNN/__init__.py deleted file mode 100644 index 63ad7d01ce..0000000000 --- a/spynnaker/pyNN/__init__.py +++ /dev/null @@ -1,701 +0,0 @@ -# Copyright (c) 2017-2022 The University of Manchester -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -""" -The :py:mod:`spynnaker.pyNN` package contains the front end specifications -and implementation for the PyNN High-level API -(http://neuralensemble.org/trac/PyNN). - -This package contains the profile of that code for PyNN 0.9 -""" - -# common imports -import logging -import numpy as __numpy -from pyNN import common as pynn_common -from pyNN.common import control as _pynn_control -from pyNN.recording import get_io -from pyNN.random import NumpyRNG, RandomDistribution as _PynnRandomDistribution -from pyNN.space import ( - Space, Line, Grid2D, Grid3D, Cuboid, Sphere, RandomStructure) -from pyNN.space import distance as _pynn_distance - -from spinn_utilities.log import FormatAdapter -from spinn_front_end_common.utilities.exceptions import ( - ConfigurationException, SimulatorNotSetupException, - SimulatorShutdownException) -from spinn_front_end_common.utilities import globals_variables - -from spynnaker.pyNN.models.abstract_pynn_model import AbstractPyNNModel - -# connections -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neural_projections.connectors import ( - AllToAllConnector, ArrayConnector, CSAConnector, - DistanceDependentProbabilityConnector, FixedNumberPostConnector, - FixedNumberPreConnector, FixedProbabilityConnector, - FromFileConnector, FromListConnector, IndexBasedProbabilityConnector, - KernelConnector, MultapseConnector as FixedTotalNumberConnector, - OneToOneConnector, SmallWorldConnector) -# synapse structures -from spynnaker.pyNN.models.neuron.synapse_dynamics import ( - SynapseDynamicsStatic as StaticSynapse) - -# plastic stuff -from spynnaker.pyNN.models.neuron.synapse_dynamics import ( - SynapseDynamicsSTDP as - STDPMechanism, SynapseDynamicsStructuralStatic as - StructuralMechanismStatic, SynapseDynamicsStructuralSTDP as - StructuralMechanismSTDP) -from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( - WeightDependenceAdditive as - AdditiveWeightDependence, WeightDependenceMultiplicative as - MultiplicativeWeightDependence) -from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( - TimingDependenceSpikePair as - SpikePairRule) -from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ - .partner_selection import ( - LastNeuronSelection, RandomSelection) -from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ - .formation import ( - DistanceDependentFormation) -from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ - .elimination import ( - RandomByWeightElimination) - -# neuron stuff -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neuron.builds.if_cond_exp_base import ( - IFCondExpBase as IF_cond_exp) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neuron.builds.if_curr_exp_base import ( - IFCurrExpBase as IF_curr_exp) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neuron.builds.if_curr_alpha import ( - IFCurrAlpha as IF_curr_alpha) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neuron.builds.if_curr_delta import ( - IFCurrDelta as IF_curr_delta) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.neuron.builds.izk_curr_exp_base import ( - IzkCurrExpBase as Izhikevich) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.spike_source.spike_source_array import ( - SpikeSourceArray) -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.spike_source.spike_source_poisson import ( - SpikeSourcePoisson) - -# pops -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.populations import ( - Assembly, Population, PopulationView) - -# projection -# noinspection PyUnresolvedReferences -from spynnaker.pyNN.models.projection import Projection as SpiNNakerProjection - -from spynnaker.pyNN import external_devices -from spynnaker.pyNN import extra_models - -# big stuff -from spynnaker.pyNN.spinnaker import SpiNNaker - -from spynnaker._version import __version__ # NOQA -from spynnaker._version import __version_name__ # NOQA -from spynnaker._version import __version_month__ # NOQA -from spynnaker._version import __version_year__ # NOQA - - -#: The timestep to use of "auto" is specified as a timestep -SPYNNAKER_AUTO_TIMESTEP = 1.0 - -logger = FormatAdapter(logging.getLogger(__name__)) - -__all__ = [ - # PyNN imports - 'Cuboid', 'distance', 'Grid2D', 'Grid3D', 'Line', 'NumpyRNG', - 'RandomDistribution', 'RandomStructure', 'Space', 'Sphere', - - # connections - 'AllToAllConnector', 'ArrayConnector', 'CSAConnector', - 'DistanceDependentProbabilityConnector', 'FixedNumberPostConnector', - 'FixedNumberPreConnector', 'FixedProbabilityConnector', - 'FromFileConnector', 'FromListConnector', 'IndexBasedProbabilityConnector', - 'FixedTotalNumberConnector', 'KernelConnector', 'OneToOneConnector', - 'SmallWorldConnector', - # synapse structures - 'StaticSynapse', - # plastic stuff - 'STDPMechanism', 'AdditiveWeightDependence', - 'MultiplicativeWeightDependence', 'SpikePairRule', - # Structural plasticity by Petrut Bogdan - 'StructuralMechanismStatic', 'StructuralMechanismSTDP', - 'LastNeuronSelection', 'RandomSelection', - 'DistanceDependentFormation', 'RandomByWeightElimination', - # neuron stuff - 'IF_cond_exp', 'IF_curr_exp', "IF_curr_alpha", "IF_curr_delta", - 'Izhikevich', 'SpikeSourceArray', 'SpikeSourcePoisson', - # pops - 'Assembly', 'Population', 'PopulationView', - # projection - 'SpiNNakerProjection', - # External devices and extra models - 'external_devices', 'extra_models', - # Stuff that we define - 'end', 'setup', 'run', 'run_until', 'run_for', 'num_processes', 'rank', - 'reset', 'set_number_of_neurons_per_core', - 'Projection', - 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', - 'get_max_delay', 'initialize', 'list_standard_models', 'name', - 'record', 'record_v', 'record_gsyn', "get_machine"] - -# Dynamically-extracted operations from PyNN -__pynn = {} - - -class RandomDistribution(_PynnRandomDistribution): - """ Class which defines a next(n) method which returns an array of ``n``\ - random numbers from a given distribution. - - :param str distribution: the name of a random number distribution. - :param parameters_pos: - parameters of the distribution, provided as a tuple. For the correct - ordering, see `random.available_distributions`. - :type parameters_pos: tuple or None - :param rng: the random number generator to use, if a specific one is - desired (e.g., to provide a seed). - :type rng: ~pyNN.random.NumpyRNG or ~pyNN.random.GSLRNG or - ~pyNN.random.NativeRNG or None - :param parameters_named: - parameters of the distribution, provided as keyword arguments. - - Parameters may be provided either through ``parameters_pos`` or through - ``parameters_named``, but not both. All parameters must be provided, there - are no default values. Parameter names are, in general, as used in - Wikipedia. - - Examples:: - - >>> rd = RandomDistribution('uniform', (-70, -50)) - >>> rd = RandomDistribution('normal', mu=0.5, sigma=0.1) - >>> rng = NumpyRNG(seed=8658764) - >>> rd = RandomDistribution('gamma', k=2.0, theta=5.0, rng=rng) - - .. list-table:: Available distributions - :widths: auto - :header-rows: 1 - - * - Name - - Parameters - - Comments - * - ``binomial`` - - ``n``, ``p`` - - - * - ``gamma`` - - ``k``, ``theta`` - - - * - ``exponential`` - - ``beta`` - - - * - ``lognormal`` - - ``mu``, ``sigma`` - - - * - ``normal`` - - ``mu``, ``sigma`` - - - * - ``normal_clipped`` - - ``mu``, ``sigma``, ``low``, ``high`` - - Values outside (``low``, ``high``) are redrawn - * - ``normal_clipped_to_boundary`` - - ``mu``, ``sigma``, ``low``, ``high`` - - Values below/above ``low``/``high`` are set to ``low``/``high`` - * - ``poisson`` - - ``lambda_`` - - Trailing underscore since ``lambda`` is a Python keyword - * - ``uniform`` - - ``low``, ``high`` - - - * - ``uniform_int`` - - ``low``, ``high`` - - Only generates integer values - * - ``vonmises`` - - ``mu``, ``kappa`` - - - """ - - def __repr__(self): - return self.__str__() - - -# Patch the bugs in the PyNN documentation... Ugh! -def distance(src, tgt, mask=None, scale_factor=1.0, offset=0.0, - periodic_boundaries=None): - """ Return the Euclidian distance between two cells. - - :param src: - :param tgt: - :param ~numpy.ndarray mask: - allows only certain dimensions to be considered, e.g.: - * to ignore the z-dimension, use ``mask=array([0,1])`` - * to ignore y, ``mask=array([0,2])`` - * to just consider z-distance, ``mask=array([2])`` - :param float scale_factor: allows for different units in the pre- and - post-position (the post-synaptic position is multiplied by this - quantity). - :param float offset: - :param periodic_boundaries: - """ - return _pynn_distance( - src, tgt, mask, scale_factor, offset, periodic_boundaries) - - -def setup(timestep=_pynn_control.DEFAULT_TIMESTEP, - min_delay=_pynn_control.DEFAULT_MIN_DELAY, - max_delay=None, - graph_label=None, - database_socket_addresses=None, time_scale_factor=None, - n_chips_required=None, n_boards_required=None, **extra_params): - """ The main method needed to be called to make the PyNN 0.8 setup. Needs\ - to be called before any other function - - :param timestep: - the time step of the simulations in micro seconds - if None the cfg value is used - :type timestep: - float or None - :param min_delay: the min delay of the simulation - :type min_delay: float or str - :param max_delay: Ignored and logs a warning if provided - :type max_delay: float or str or None - :param graph_label: the label for the graph - :type graph_label: str or None - :param database_socket_addresses: the sockets used by external devices - for the database notification protocol - :type database_socket_addresses: - iterable(~spinn_utilities.socket_address.SocketAddress) - :param time_scale_factor: multiplicative factor to the machine time step - (does not affect the neuron models accuracy) - :type time_scale_factor: int or None - :param n_chips_required: - Deprecated! Use n_boards_required instead. - Must be None if n_boards_required specified. - :type n_chips_required: int or None - :param n_boards_required: - if you need to be allocated a machine (for spalloc) before building - your graph, then fill this in with a general idea of the number of - boards you need so that the spalloc system can allocate you a machine - big enough for your needs. - :type n_boards_required: int or None - :param extra_params: other keyword argumets used to configure PyNN - :return: MPI rank (always 0 on SpiNNaker) - :rtype: int - :raises ConfigurationException: if both ``n_chips_required`` and - ``n_boards_required`` are used. - """ - # Check for "auto" values - if timestep == "auto": - timestep = SPYNNAKER_AUTO_TIMESTEP - if min_delay == "auto": - min_delay = timestep - if max_delay: - logger.warning( - "max_delay is not supported by sPyNNaker so will be ignored") - - # pylint: disable=too-many-arguments, too-many-function-args - # setup PyNN common stuff - pynn_common.setup(timestep, min_delay, **extra_params) - - # create stuff simulator - if globals_variables.has_simulator(): - logger.warning("Calling setup a second time causes the previous " - "simulator to be stopped and cleared.") - # if already exists, kill and rebuild - try: - globals_variables.get_simulator().clear() - except Exception: # pylint: disable=broad-except - logger.exception("Error forcing previous simulation to clear") - - # add default label if needed - if graph_label is None: - graph_label = "PyNN0.8_graph" - - # create the main object for all stuff related software - SpiNNaker( - database_socket_addresses=database_socket_addresses, - time_scale_factor=time_scale_factor, timestep=timestep, - min_delay=min_delay, graph_label=graph_label, - n_chips_required=n_chips_required, - n_boards_required=n_boards_required) - - # warn about kwargs arguments - if extra_params: - logger.warning("Extra params {} have been applied to the setup " - "command which we do not consider", extra_params) - - # get overloaded functions from PyNN in relation of our simulator object - _create_overloaded_functions(globals_variables.get_simulator()) - - return rank() - - -def name(): - """ Returns the name of the simulator - - :rtype: str - """ - return globals_variables.get_last_simulator().name - - -def Projection( - presynaptic_population, postsynaptic_population, - connector, synapse_type=None, source=None, receptor_type="excitatory", - space=None, label=None): - """ Used to support PEP 8 spelling correctly - - :param presynaptic_population: the source pop - :type presynaptic_population: - ~spynnaker.pyNN.models.populations.Population - :param postsynaptic_population: the dest pop - :type postsynaptic_population: - ~spynnaker.pyNN.models.populations.Population - :param AbstractConnector connector: the connector type - :param AbstractStaticSynapseDynamics synapse_type: the synapse type - :param None source: Unsupported; must be ``None`` - :param str receptor_type: the receptor type - :param space: the space object - :type space: ~pyNN.space.Space or None - :param label: the label - :type label: str or None - :return: a projection object for SpiNNaker - :rtype: ~spynnaker.pyNN.models.projection.Projection - """ - # pylint: disable=too-many-arguments - return SpiNNakerProjection( - pre_synaptic_population=presynaptic_population, - post_synaptic_population=postsynaptic_population, connector=connector, - synapse_type=synapse_type, source=source, receptor_type=receptor_type, - space=space, label=label) - - -def _create_overloaded_functions(spinnaker_simulator): - """ Creates functions that the main PyNN interface supports\ - (given from PyNN) - - :param spinnaker_simulator: the simulator object we use underneath - """ - - # overload the failed ones with now valid ones, now that we're in setup - # phase. - __pynn["run"], __pynn["run_until"] = pynn_common.build_run( - spinnaker_simulator) - - __pynn["get_current_time"], __pynn["get_time_step"], \ - __pynn["get_min_delay"], __pynn["get_max_delay"], \ - __pynn["num_processes"], __pynn["rank"] = \ - pynn_common.build_state_queries(spinnaker_simulator) - - __pynn["reset"] = pynn_common.build_reset(spinnaker_simulator) - __pynn["create"] = pynn_common.build_create(Population) - - __pynn["connect"] = pynn_common.build_connect( - Projection, FixedProbabilityConnector, StaticSynapse) - - __pynn["record"] = pynn_common.build_record(spinnaker_simulator) - - -def end(_=True): - """ Cleans up the SpiNNaker machine and software - - :param _: was named compatible_output, which we don't care about, - so is a non-existent parameter - """ - try: - simulator = globals_variables.get_simulator() - except SimulatorShutdownException: - logger.warning("Second call to end ignored") - return - except SimulatorNotSetupException: - logger.exception("Calling end before setup makes no sense ignoring!") - return - for (population, variables, filename) in \ - simulator.write_on_end: - io = get_io(filename) - population.write_data(io, variables) - simulator.write_on_end = [] - simulator.stop() - - -def record_v(source, filename): - """ Deprecated method for getting voltage.\ - This is not documented in the public facing API. - - .. deprecated:: 5.0 - - :param source: the population / view / assembly to record - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: the neo file to write to - :rtype: None - """ - logger.warning( - "Using record_v is deprecated. Use record('v') function instead") - record(['v'], source, filename) - - -def record_gsyn(source, filename): - """ Deprecated method for getting both types of gsyn.\ - This is not documented in the public facing API - - .. deprecated:: 5.0 - - :param source: the population / view / assembly to record - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: the neo file to write to - """ - logger.warning( - "Using record_gsyn is deprecated. Use record('gsyn_exc') and/or" - " record('gsyn_inh') function instead") - record(['gsyn_exc', 'gsyn_inh'], source, filename) - - -def list_standard_models(): - """ Return a list of all the StandardCellType classes available for this\ - simulator. - - :rtype: list(str) - """ - results = list() - for (key, obj) in globals().items(): - if isinstance(obj, type) and issubclass(obj, AbstractPyNNModel): - results.append(key) - return results - - -def set_number_of_neurons_per_core(neuron_type, max_permitted): - """ Sets a ceiling on the number of neurons of a given type that can be\ - placed on a single core. - - :param type(AbstractPopulationVertex) neuron_type: neuron type - :param int max_permitted: the number to set to - """ - if isinstance(neuron_type, str): - msg = "set_number_of_neurons_per_core call now expects " \ - "neuron_type as a class instead of as a str" - raise ConfigurationException(msg) - simulator = globals_variables.get_simulator() - simulator.set_number_of_neurons_per_core( - neuron_type, max_permitted) - - -# These methods will defer to PyNN methods if a simulator exists - - -def connect(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, - rng=None): - """ Builds a projection - - :param ~spynnaker.pyNN.models.populations.Population pre: source pop - :param ~spynnaker.pyNN.models.populations.Population post: destination pop - :param float weight: weight of the connections - :param float delay: the delay of the connections - :param str receptor_type: excitatory / inhibitory - :param float p: probability - :param ~pyNN.random.NumpyRNG rng: random number generator - """ - # pylint: disable=too-many-arguments - globals_variables.check_simulator() - __pynn["connect"](pre, post, weight, delay, receptor_type, p, rng) - - -def create(cellclass, cellparams=None, n=1): - """ Builds a population with certain params - - :param cellclass: population class - :type cellclass: type or AbstractPyNNModel - :param cellparams: population params. - :param int n: n neurons - :rtype: ~spynnaker.pyNN.models.populations.Population - """ - globals_variables.check_simulator() - return __pynn["create"](cellclass, cellparams, n) - - -def NativeRNG(seed_value): - """ Fixes the random number generator's seed - - :param seed_value: - :type seed_value: int or list(int) or ~numpy.ndarray(int32) - """ - __numpy.random.seed(seed_value) - - -def get_current_time(): - """ Gets the time within the simulation - - :return: returns the current time - """ - globals_variables.check_simulator() - return __pynn["get_current_time"]() - - -def get_min_delay(): - """ The minimum allowed synaptic delay; delays will be clamped to be at\ - least this. - - :return: returns the min delay of the simulation - :rtype: int - """ - globals_variables.check_simulator() - return __pynn["get_min_delay"]() - - -def get_max_delay(): - """ Part of the PyNN api but does not make sense for sPyNNaker as - different Projection, Vertex splitter combination could have different - delays they can support - - Most likely value is timestep * 144 - - :raises NotImplementedError: As there is no system wide max_delay - """ - raise NotImplementedError( - "sPyNNaker does not have a system wide max_delay") - - -def get_time_step(): - """ The integration time step - - :return: get the time step of the simulation (in ms) - :rtype: float - """ - globals_variables.check_simulator() - return float(__pynn["get_time_step"]()) - - -def initialize(cells, **initial_values): - """ Sets cells to be initialised to the given values - - :param cells: the cells to change params on - :type cells: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param initial_values: the params and their values to change - """ - globals_variables.check_simulator() - pynn_common.initialize(cells, **initial_values) - - -def num_processes(): - """ The number of MPI processes. - - .. note:: - Always 1 on SpiNNaker, which doesn't use MPI. - - :return: the number of MPI processes - :rtype: int - """ - globals_variables.check_simulator() - return __pynn["num_processes"]() - - -def rank(): - """ The MPI rank of the current node. - - .. note:: - Always 0 on SpiNNaker, which doesn't use MPI. - - :return: MPI rank - :rtype: int - """ - globals_variables.check_simulator() - return __pynn["rank"]() - - -def record(variables, source, filename, sampling_interval=None, - annotations=None): - """ Sets variables to be recorded. - - :param variables: may be either a single variable name or a list of - variable names. For a given celltype class, celltype.recordable - contains a list of variables that can be recorded for that celltype. - :type variables: str or list(str) - :param source: where to record from - :type source: ~spynnaker.pyNN.models.populations.Population or - ~spynnaker.pyNN.models.populations.PopulationView - :param str filename: file name to write data to - :param sampling_interval: - how often to sample the recording, not ignored so far - :param annotations: the annotations to data writers - :type annotations: dict(str, ...) - :return: neo object - :rtype: ~neo.core.Block - """ - globals_variables.check_simulator() - return __pynn["record"](variables, source, filename, sampling_interval, - annotations) - - -def reset(annotations=None): - """ Resets the simulation to t = 0 - - :param annotations: the annotations to the data objects - :type annotations: dict(str, ...) - :rtype: None - """ - if annotations is None: - annotations = {} - globals_variables.check_simulator() - __pynn["reset"](annotations) - - -def run(simtime, callbacks=None): - """ The run() function advances the simulation for a given number of \ - milliseconds, e.g.: - - :param float simtime: time to run for (in milliseconds) - :param callbacks: callbacks to run - :return: the actual simulation time that the simulation stopped at - :rtype: float - """ - globals_variables.check_simulator() - return __pynn["run"](simtime, callbacks=callbacks) - - -# left here because needs to be done, and no better place to put it -# (ABS don't like it, but will put up with it) -run_for = run - - -def run_until(tstop): - """ Run until a (simulation) time period has completed. - - :param float tstop: the time to stop at (in milliseconds) - :return: the actual simulation time that the simulation stopped at - :rtype: float - """ - globals_variables.check_simulator() - return __pynn["run_until"](tstop) - - -def get_machine(): - """ Get the SpiNNaker machine in use. - - :return: the machine object - :rtype: ~spinn_machine.Machine - """ - globals_variables.check_simulator() - return globals_variables.get_simulator().machine From f89c4b78b960341512e663d94a8f49cecbc61bc0 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 09:44:46 +0100 Subject: [PATCH 43/47] file missing from merge --- spynnaker/pyNN/__init__.py | 701 +++++++++++++++++++++++++++++++++++++ 1 file changed, 701 insertions(+) create mode 100644 spynnaker/pyNN/__init__.py diff --git a/spynnaker/pyNN/__init__.py b/spynnaker/pyNN/__init__.py new file mode 100644 index 0000000000..63ad7d01ce --- /dev/null +++ b/spynnaker/pyNN/__init__.py @@ -0,0 +1,701 @@ +# Copyright (c) 2017-2022 The University of Manchester +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +The :py:mod:`spynnaker.pyNN` package contains the front end specifications +and implementation for the PyNN High-level API +(http://neuralensemble.org/trac/PyNN). + +This package contains the profile of that code for PyNN 0.9 +""" + +# common imports +import logging +import numpy as __numpy +from pyNN import common as pynn_common +from pyNN.common import control as _pynn_control +from pyNN.recording import get_io +from pyNN.random import NumpyRNG, RandomDistribution as _PynnRandomDistribution +from pyNN.space import ( + Space, Line, Grid2D, Grid3D, Cuboid, Sphere, RandomStructure) +from pyNN.space import distance as _pynn_distance + +from spinn_utilities.log import FormatAdapter +from spinn_front_end_common.utilities.exceptions import ( + ConfigurationException, SimulatorNotSetupException, + SimulatorShutdownException) +from spinn_front_end_common.utilities import globals_variables + +from spynnaker.pyNN.models.abstract_pynn_model import AbstractPyNNModel + +# connections +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neural_projections.connectors import ( + AllToAllConnector, ArrayConnector, CSAConnector, + DistanceDependentProbabilityConnector, FixedNumberPostConnector, + FixedNumberPreConnector, FixedProbabilityConnector, + FromFileConnector, FromListConnector, IndexBasedProbabilityConnector, + KernelConnector, MultapseConnector as FixedTotalNumberConnector, + OneToOneConnector, SmallWorldConnector) +# synapse structures +from spynnaker.pyNN.models.neuron.synapse_dynamics import ( + SynapseDynamicsStatic as StaticSynapse) + +# plastic stuff +from spynnaker.pyNN.models.neuron.synapse_dynamics import ( + SynapseDynamicsSTDP as + STDPMechanism, SynapseDynamicsStructuralStatic as + StructuralMechanismStatic, SynapseDynamicsStructuralSTDP as + StructuralMechanismSTDP) +from spynnaker.pyNN.models.neuron.plasticity.stdp.weight_dependence import ( + WeightDependenceAdditive as + AdditiveWeightDependence, WeightDependenceMultiplicative as + MultiplicativeWeightDependence) +from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( + TimingDependenceSpikePair as + SpikePairRule) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .partner_selection import ( + LastNeuronSelection, RandomSelection) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .formation import ( + DistanceDependentFormation) +from spynnaker.pyNN.models.neuron.structural_plasticity.synaptogenesis\ + .elimination import ( + RandomByWeightElimination) + +# neuron stuff +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_cond_exp_base import ( + IFCondExpBase as IF_cond_exp) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_exp_base import ( + IFCurrExpBase as IF_curr_exp) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_alpha import ( + IFCurrAlpha as IF_curr_alpha) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.if_curr_delta import ( + IFCurrDelta as IF_curr_delta) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.neuron.builds.izk_curr_exp_base import ( + IzkCurrExpBase as Izhikevich) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.spike_source.spike_source_array import ( + SpikeSourceArray) +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.spike_source.spike_source_poisson import ( + SpikeSourcePoisson) + +# pops +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.populations import ( + Assembly, Population, PopulationView) + +# projection +# noinspection PyUnresolvedReferences +from spynnaker.pyNN.models.projection import Projection as SpiNNakerProjection + +from spynnaker.pyNN import external_devices +from spynnaker.pyNN import extra_models + +# big stuff +from spynnaker.pyNN.spinnaker import SpiNNaker + +from spynnaker._version import __version__ # NOQA +from spynnaker._version import __version_name__ # NOQA +from spynnaker._version import __version_month__ # NOQA +from spynnaker._version import __version_year__ # NOQA + + +#: The timestep to use of "auto" is specified as a timestep +SPYNNAKER_AUTO_TIMESTEP = 1.0 + +logger = FormatAdapter(logging.getLogger(__name__)) + +__all__ = [ + # PyNN imports + 'Cuboid', 'distance', 'Grid2D', 'Grid3D', 'Line', 'NumpyRNG', + 'RandomDistribution', 'RandomStructure', 'Space', 'Sphere', + + # connections + 'AllToAllConnector', 'ArrayConnector', 'CSAConnector', + 'DistanceDependentProbabilityConnector', 'FixedNumberPostConnector', + 'FixedNumberPreConnector', 'FixedProbabilityConnector', + 'FromFileConnector', 'FromListConnector', 'IndexBasedProbabilityConnector', + 'FixedTotalNumberConnector', 'KernelConnector', 'OneToOneConnector', + 'SmallWorldConnector', + # synapse structures + 'StaticSynapse', + # plastic stuff + 'STDPMechanism', 'AdditiveWeightDependence', + 'MultiplicativeWeightDependence', 'SpikePairRule', + # Structural plasticity by Petrut Bogdan + 'StructuralMechanismStatic', 'StructuralMechanismSTDP', + 'LastNeuronSelection', 'RandomSelection', + 'DistanceDependentFormation', 'RandomByWeightElimination', + # neuron stuff + 'IF_cond_exp', 'IF_curr_exp', "IF_curr_alpha", "IF_curr_delta", + 'Izhikevich', 'SpikeSourceArray', 'SpikeSourcePoisson', + # pops + 'Assembly', 'Population', 'PopulationView', + # projection + 'SpiNNakerProjection', + # External devices and extra models + 'external_devices', 'extra_models', + # Stuff that we define + 'end', 'setup', 'run', 'run_until', 'run_for', 'num_processes', 'rank', + 'reset', 'set_number_of_neurons_per_core', + 'Projection', + 'get_current_time', 'create', 'connect', 'get_time_step', 'get_min_delay', + 'get_max_delay', 'initialize', 'list_standard_models', 'name', + 'record', 'record_v', 'record_gsyn', "get_machine"] + +# Dynamically-extracted operations from PyNN +__pynn = {} + + +class RandomDistribution(_PynnRandomDistribution): + """ Class which defines a next(n) method which returns an array of ``n``\ + random numbers from a given distribution. + + :param str distribution: the name of a random number distribution. + :param parameters_pos: + parameters of the distribution, provided as a tuple. For the correct + ordering, see `random.available_distributions`. + :type parameters_pos: tuple or None + :param rng: the random number generator to use, if a specific one is + desired (e.g., to provide a seed). + :type rng: ~pyNN.random.NumpyRNG or ~pyNN.random.GSLRNG or + ~pyNN.random.NativeRNG or None + :param parameters_named: + parameters of the distribution, provided as keyword arguments. + + Parameters may be provided either through ``parameters_pos`` or through + ``parameters_named``, but not both. All parameters must be provided, there + are no default values. Parameter names are, in general, as used in + Wikipedia. + + Examples:: + + >>> rd = RandomDistribution('uniform', (-70, -50)) + >>> rd = RandomDistribution('normal', mu=0.5, sigma=0.1) + >>> rng = NumpyRNG(seed=8658764) + >>> rd = RandomDistribution('gamma', k=2.0, theta=5.0, rng=rng) + + .. list-table:: Available distributions + :widths: auto + :header-rows: 1 + + * - Name + - Parameters + - Comments + * - ``binomial`` + - ``n``, ``p`` + - + * - ``gamma`` + - ``k``, ``theta`` + - + * - ``exponential`` + - ``beta`` + - + * - ``lognormal`` + - ``mu``, ``sigma`` + - + * - ``normal`` + - ``mu``, ``sigma`` + - + * - ``normal_clipped`` + - ``mu``, ``sigma``, ``low``, ``high`` + - Values outside (``low``, ``high``) are redrawn + * - ``normal_clipped_to_boundary`` + - ``mu``, ``sigma``, ``low``, ``high`` + - Values below/above ``low``/``high`` are set to ``low``/``high`` + * - ``poisson`` + - ``lambda_`` + - Trailing underscore since ``lambda`` is a Python keyword + * - ``uniform`` + - ``low``, ``high`` + - + * - ``uniform_int`` + - ``low``, ``high`` + - Only generates integer values + * - ``vonmises`` + - ``mu``, ``kappa`` + - + """ + + def __repr__(self): + return self.__str__() + + +# Patch the bugs in the PyNN documentation... Ugh! +def distance(src, tgt, mask=None, scale_factor=1.0, offset=0.0, + periodic_boundaries=None): + """ Return the Euclidian distance between two cells. + + :param src: + :param tgt: + :param ~numpy.ndarray mask: + allows only certain dimensions to be considered, e.g.: + * to ignore the z-dimension, use ``mask=array([0,1])`` + * to ignore y, ``mask=array([0,2])`` + * to just consider z-distance, ``mask=array([2])`` + :param float scale_factor: allows for different units in the pre- and + post-position (the post-synaptic position is multiplied by this + quantity). + :param float offset: + :param periodic_boundaries: + """ + return _pynn_distance( + src, tgt, mask, scale_factor, offset, periodic_boundaries) + + +def setup(timestep=_pynn_control.DEFAULT_TIMESTEP, + min_delay=_pynn_control.DEFAULT_MIN_DELAY, + max_delay=None, + graph_label=None, + database_socket_addresses=None, time_scale_factor=None, + n_chips_required=None, n_boards_required=None, **extra_params): + """ The main method needed to be called to make the PyNN 0.8 setup. Needs\ + to be called before any other function + + :param timestep: + the time step of the simulations in micro seconds + if None the cfg value is used + :type timestep: + float or None + :param min_delay: the min delay of the simulation + :type min_delay: float or str + :param max_delay: Ignored and logs a warning if provided + :type max_delay: float or str or None + :param graph_label: the label for the graph + :type graph_label: str or None + :param database_socket_addresses: the sockets used by external devices + for the database notification protocol + :type database_socket_addresses: + iterable(~spinn_utilities.socket_address.SocketAddress) + :param time_scale_factor: multiplicative factor to the machine time step + (does not affect the neuron models accuracy) + :type time_scale_factor: int or None + :param n_chips_required: + Deprecated! Use n_boards_required instead. + Must be None if n_boards_required specified. + :type n_chips_required: int or None + :param n_boards_required: + if you need to be allocated a machine (for spalloc) before building + your graph, then fill this in with a general idea of the number of + boards you need so that the spalloc system can allocate you a machine + big enough for your needs. + :type n_boards_required: int or None + :param extra_params: other keyword argumets used to configure PyNN + :return: MPI rank (always 0 on SpiNNaker) + :rtype: int + :raises ConfigurationException: if both ``n_chips_required`` and + ``n_boards_required`` are used. + """ + # Check for "auto" values + if timestep == "auto": + timestep = SPYNNAKER_AUTO_TIMESTEP + if min_delay == "auto": + min_delay = timestep + if max_delay: + logger.warning( + "max_delay is not supported by sPyNNaker so will be ignored") + + # pylint: disable=too-many-arguments, too-many-function-args + # setup PyNN common stuff + pynn_common.setup(timestep, min_delay, **extra_params) + + # create stuff simulator + if globals_variables.has_simulator(): + logger.warning("Calling setup a second time causes the previous " + "simulator to be stopped and cleared.") + # if already exists, kill and rebuild + try: + globals_variables.get_simulator().clear() + except Exception: # pylint: disable=broad-except + logger.exception("Error forcing previous simulation to clear") + + # add default label if needed + if graph_label is None: + graph_label = "PyNN0.8_graph" + + # create the main object for all stuff related software + SpiNNaker( + database_socket_addresses=database_socket_addresses, + time_scale_factor=time_scale_factor, timestep=timestep, + min_delay=min_delay, graph_label=graph_label, + n_chips_required=n_chips_required, + n_boards_required=n_boards_required) + + # warn about kwargs arguments + if extra_params: + logger.warning("Extra params {} have been applied to the setup " + "command which we do not consider", extra_params) + + # get overloaded functions from PyNN in relation of our simulator object + _create_overloaded_functions(globals_variables.get_simulator()) + + return rank() + + +def name(): + """ Returns the name of the simulator + + :rtype: str + """ + return globals_variables.get_last_simulator().name + + +def Projection( + presynaptic_population, postsynaptic_population, + connector, synapse_type=None, source=None, receptor_type="excitatory", + space=None, label=None): + """ Used to support PEP 8 spelling correctly + + :param presynaptic_population: the source pop + :type presynaptic_population: + ~spynnaker.pyNN.models.populations.Population + :param postsynaptic_population: the dest pop + :type postsynaptic_population: + ~spynnaker.pyNN.models.populations.Population + :param AbstractConnector connector: the connector type + :param AbstractStaticSynapseDynamics synapse_type: the synapse type + :param None source: Unsupported; must be ``None`` + :param str receptor_type: the receptor type + :param space: the space object + :type space: ~pyNN.space.Space or None + :param label: the label + :type label: str or None + :return: a projection object for SpiNNaker + :rtype: ~spynnaker.pyNN.models.projection.Projection + """ + # pylint: disable=too-many-arguments + return SpiNNakerProjection( + pre_synaptic_population=presynaptic_population, + post_synaptic_population=postsynaptic_population, connector=connector, + synapse_type=synapse_type, source=source, receptor_type=receptor_type, + space=space, label=label) + + +def _create_overloaded_functions(spinnaker_simulator): + """ Creates functions that the main PyNN interface supports\ + (given from PyNN) + + :param spinnaker_simulator: the simulator object we use underneath + """ + + # overload the failed ones with now valid ones, now that we're in setup + # phase. + __pynn["run"], __pynn["run_until"] = pynn_common.build_run( + spinnaker_simulator) + + __pynn["get_current_time"], __pynn["get_time_step"], \ + __pynn["get_min_delay"], __pynn["get_max_delay"], \ + __pynn["num_processes"], __pynn["rank"] = \ + pynn_common.build_state_queries(spinnaker_simulator) + + __pynn["reset"] = pynn_common.build_reset(spinnaker_simulator) + __pynn["create"] = pynn_common.build_create(Population) + + __pynn["connect"] = pynn_common.build_connect( + Projection, FixedProbabilityConnector, StaticSynapse) + + __pynn["record"] = pynn_common.build_record(spinnaker_simulator) + + +def end(_=True): + """ Cleans up the SpiNNaker machine and software + + :param _: was named compatible_output, which we don't care about, + so is a non-existent parameter + """ + try: + simulator = globals_variables.get_simulator() + except SimulatorShutdownException: + logger.warning("Second call to end ignored") + return + except SimulatorNotSetupException: + logger.exception("Calling end before setup makes no sense ignoring!") + return + for (population, variables, filename) in \ + simulator.write_on_end: + io = get_io(filename) + population.write_data(io, variables) + simulator.write_on_end = [] + simulator.stop() + + +def record_v(source, filename): + """ Deprecated method for getting voltage.\ + This is not documented in the public facing API. + + .. deprecated:: 5.0 + + :param source: the population / view / assembly to record + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: the neo file to write to + :rtype: None + """ + logger.warning( + "Using record_v is deprecated. Use record('v') function instead") + record(['v'], source, filename) + + +def record_gsyn(source, filename): + """ Deprecated method for getting both types of gsyn.\ + This is not documented in the public facing API + + .. deprecated:: 5.0 + + :param source: the population / view / assembly to record + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: the neo file to write to + """ + logger.warning( + "Using record_gsyn is deprecated. Use record('gsyn_exc') and/or" + " record('gsyn_inh') function instead") + record(['gsyn_exc', 'gsyn_inh'], source, filename) + + +def list_standard_models(): + """ Return a list of all the StandardCellType classes available for this\ + simulator. + + :rtype: list(str) + """ + results = list() + for (key, obj) in globals().items(): + if isinstance(obj, type) and issubclass(obj, AbstractPyNNModel): + results.append(key) + return results + + +def set_number_of_neurons_per_core(neuron_type, max_permitted): + """ Sets a ceiling on the number of neurons of a given type that can be\ + placed on a single core. + + :param type(AbstractPopulationVertex) neuron_type: neuron type + :param int max_permitted: the number to set to + """ + if isinstance(neuron_type, str): + msg = "set_number_of_neurons_per_core call now expects " \ + "neuron_type as a class instead of as a str" + raise ConfigurationException(msg) + simulator = globals_variables.get_simulator() + simulator.set_number_of_neurons_per_core( + neuron_type, max_permitted) + + +# These methods will defer to PyNN methods if a simulator exists + + +def connect(pre, post, weight=0.0, delay=None, receptor_type=None, p=1, + rng=None): + """ Builds a projection + + :param ~spynnaker.pyNN.models.populations.Population pre: source pop + :param ~spynnaker.pyNN.models.populations.Population post: destination pop + :param float weight: weight of the connections + :param float delay: the delay of the connections + :param str receptor_type: excitatory / inhibitory + :param float p: probability + :param ~pyNN.random.NumpyRNG rng: random number generator + """ + # pylint: disable=too-many-arguments + globals_variables.check_simulator() + __pynn["connect"](pre, post, weight, delay, receptor_type, p, rng) + + +def create(cellclass, cellparams=None, n=1): + """ Builds a population with certain params + + :param cellclass: population class + :type cellclass: type or AbstractPyNNModel + :param cellparams: population params. + :param int n: n neurons + :rtype: ~spynnaker.pyNN.models.populations.Population + """ + globals_variables.check_simulator() + return __pynn["create"](cellclass, cellparams, n) + + +def NativeRNG(seed_value): + """ Fixes the random number generator's seed + + :param seed_value: + :type seed_value: int or list(int) or ~numpy.ndarray(int32) + """ + __numpy.random.seed(seed_value) + + +def get_current_time(): + """ Gets the time within the simulation + + :return: returns the current time + """ + globals_variables.check_simulator() + return __pynn["get_current_time"]() + + +def get_min_delay(): + """ The minimum allowed synaptic delay; delays will be clamped to be at\ + least this. + + :return: returns the min delay of the simulation + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["get_min_delay"]() + + +def get_max_delay(): + """ Part of the PyNN api but does not make sense for sPyNNaker as + different Projection, Vertex splitter combination could have different + delays they can support + + Most likely value is timestep * 144 + + :raises NotImplementedError: As there is no system wide max_delay + """ + raise NotImplementedError( + "sPyNNaker does not have a system wide max_delay") + + +def get_time_step(): + """ The integration time step + + :return: get the time step of the simulation (in ms) + :rtype: float + """ + globals_variables.check_simulator() + return float(__pynn["get_time_step"]()) + + +def initialize(cells, **initial_values): + """ Sets cells to be initialised to the given values + + :param cells: the cells to change params on + :type cells: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param initial_values: the params and their values to change + """ + globals_variables.check_simulator() + pynn_common.initialize(cells, **initial_values) + + +def num_processes(): + """ The number of MPI processes. + + .. note:: + Always 1 on SpiNNaker, which doesn't use MPI. + + :return: the number of MPI processes + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["num_processes"]() + + +def rank(): + """ The MPI rank of the current node. + + .. note:: + Always 0 on SpiNNaker, which doesn't use MPI. + + :return: MPI rank + :rtype: int + """ + globals_variables.check_simulator() + return __pynn["rank"]() + + +def record(variables, source, filename, sampling_interval=None, + annotations=None): + """ Sets variables to be recorded. + + :param variables: may be either a single variable name or a list of + variable names. For a given celltype class, celltype.recordable + contains a list of variables that can be recorded for that celltype. + :type variables: str or list(str) + :param source: where to record from + :type source: ~spynnaker.pyNN.models.populations.Population or + ~spynnaker.pyNN.models.populations.PopulationView + :param str filename: file name to write data to + :param sampling_interval: + how often to sample the recording, not ignored so far + :param annotations: the annotations to data writers + :type annotations: dict(str, ...) + :return: neo object + :rtype: ~neo.core.Block + """ + globals_variables.check_simulator() + return __pynn["record"](variables, source, filename, sampling_interval, + annotations) + + +def reset(annotations=None): + """ Resets the simulation to t = 0 + + :param annotations: the annotations to the data objects + :type annotations: dict(str, ...) + :rtype: None + """ + if annotations is None: + annotations = {} + globals_variables.check_simulator() + __pynn["reset"](annotations) + + +def run(simtime, callbacks=None): + """ The run() function advances the simulation for a given number of \ + milliseconds, e.g.: + + :param float simtime: time to run for (in milliseconds) + :param callbacks: callbacks to run + :return: the actual simulation time that the simulation stopped at + :rtype: float + """ + globals_variables.check_simulator() + return __pynn["run"](simtime, callbacks=callbacks) + + +# left here because needs to be done, and no better place to put it +# (ABS don't like it, but will put up with it) +run_for = run + + +def run_until(tstop): + """ Run until a (simulation) time period has completed. + + :param float tstop: the time to stop at (in milliseconds) + :return: the actual simulation time that the simulation stopped at + :rtype: float + """ + globals_variables.check_simulator() + return __pynn["run_until"](tstop) + + +def get_machine(): + """ Get the SpiNNaker machine in use. + + :return: the machine object + :rtype: ~spinn_machine.Machine + """ + globals_variables.check_simulator() + return globals_variables.get_simulator().machine From fdd92fcf7e18ecbe670f5f683291b8fbaab79dcd Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 11:35:32 +0100 Subject: [PATCH 44/47] report how pynn setup --- spynnaker/pyNN/setup_pynn.py | 2 +- spynnaker8/setup_pynn.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spynnaker/pyNN/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py index e36ba4c31f..2f503b1ae6 100644 --- a/spynnaker/pyNN/setup_pynn.py +++ b/spynnaker/pyNN/setup_pynn.py @@ -44,7 +44,7 @@ def install_sPyNNaker_into(module): with open(spinnaker_init, "w") as spinn_file: spinn_file.write("from spynnaker.pyNN import *\n") - print("Created {}".format(spinnaker_init)) + print(f"Created {spinnaker_init} to point to spynnaker.pyNN") def setup_pynn(): diff --git a/spynnaker8/setup_pynn.py b/spynnaker8/setup_pynn.py index 977093bb8b..4ece50c459 100644 --- a/spynnaker8/setup_pynn.py +++ b/spynnaker8/setup_pynn.py @@ -44,7 +44,7 @@ def install_sPyNNaker8_into(module): with open(spinnaker_init, "w") as spinn_file: spinn_file.write("from spynnaker8 import *\n") - print("Created {}".format(spinnaker_init)) + print(f"Created {spinnaker_init} based on depricated spynnake8") # Check the version; we really want PyNN 0.9 From 320cebc193e10fafbb6ee038ae94a05ef55f88d7 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 13:47:15 +0100 Subject: [PATCH 45/47] removed spynnaker8 setup pynn --- spynnaker/pyNN/setup_pynn.py | 2 ++ spynnaker8/setup_pynn.py | 47 +++--------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/spynnaker/pyNN/setup_pynn.py b/spynnaker/pyNN/setup_pynn.py index 2f503b1ae6..015ed67c02 100644 --- a/spynnaker/pyNN/setup_pynn.py +++ b/spynnaker/pyNN/setup_pynn.py @@ -43,6 +43,8 @@ def install_sPyNNaker_into(module): spinnaker_init = os.path.join(spinnaker_dir, "__init__.py") with open(spinnaker_init, "w") as spinn_file: spinn_file.write("from spynnaker.pyNN import *\n") + # To revert back to spynnaker8 use this line instead of the above + # spinn_file.write("from spynnaker8 import *\n") print(f"Created {spinnaker_init} to point to spynnaker.pyNN") diff --git a/spynnaker8/setup_pynn.py b/spynnaker8/setup_pynn.py index 4ece50c459..0a1c67fd05 100644 --- a/spynnaker8/setup_pynn.py +++ b/spynnaker8/setup_pynn.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2019 The University of Manchester +# Copyright (c) 2022 The University of Manchester # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,45 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -""" -This script installs sPyNNaker so that it usable as the ``pyNN.spiNNaker`` -module. - -.. note:: - This *modifies* your pyNN installation! -""" - -import os -from distutils.version import StrictVersion as Version # pylint: disable=all -import pyNN - - -def version_satisfies(module, requirement): - """ Perform a version check. This code could be smarter... - """ - return Version(module.__version__) >= Version(requirement) - - -def install_sPyNNaker8_into(module): - """ Do the actual installation by creating a package within the given\ - module's implementation. This is very nasty! - """ - spinnaker_dir = os.path.join(os.path.dirname(module.__file__), "spiNNaker") - if not os.path.exists(spinnaker_dir): - os.mkdir(spinnaker_dir) - - spinnaker_init = os.path.join(spinnaker_dir, "__init__.py") - with open(spinnaker_init, "w") as spinn_file: - spinn_file.write("from spynnaker8 import *\n") - - print(f"Created {spinnaker_init} based on depricated spynnake8") - - -# Check the version; we really want PyNN 0.9 -if not version_satisfies(pyNN, "0.9"): - raise Exception( - "PyNN version {} found; sPyNNaker 9 requires PyNN version 0.9".format( - pyNN.__version__)) - -# Perform the installation -install_sPyNNaker8_into(pyNN) +print("spannker8 s no longer being used") +print("Setup_pynn has moved to spynnaker.pyNN") +print("Please run it from there instead") From 7066b620b21a480c3308bc8d1827ef794ccf6c4c Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 13:51:33 +0100 Subject: [PATCH 46/47] spelling --- spynnaker8/setup_pynn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spynnaker8/setup_pynn.py b/spynnaker8/setup_pynn.py index 0a1c67fd05..f90d6e4126 100644 --- a/spynnaker8/setup_pynn.py +++ b/spynnaker8/setup_pynn.py @@ -13,6 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -print("spannker8 s no longer being used") -print("Setup_pynn has moved to spynnaker.pyNN") +print("spannker8 is no longer being used") +print("setup_pynn has moved to spynnaker.pyNN") print("Please run it from there instead") From 70697affda67d484f2a6f30fe92f8af3f45b487a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 20 Apr 2022 14:01:23 +0100 Subject: [PATCH 47/47] fix test --- .../test_external_devices/test_multiboard_spike_output.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py index d245ef078f..032b4bb643 100644 --- a/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py +++ b/spynnaker_integration_tests/test_external_devices/test_multiboard_spike_output.py @@ -17,6 +17,7 @@ from unittest import SkipTest from spynnaker.pyNN.exceptions import ConfigurationException import pyNN.spiNNaker as p +import spynnaker.pyNN.external_devices as e from spinnaker_testbase import BaseTestCase