PyNN on SpiNNaker Installation Guide

Follow me on GitHub

This guide will detail how to install the release version of the tools required to run simulations on SpiNNaker using the PyNN scripting language.

Installation

You must first install the Python Dependencies. Continue to the Standard Central Installation, User-only Installation or Virtualenv Installation to install the remaining requirements, depending on the needs of your working environment.

Note: sPyNNakerExternalDevicesPlugin and sPyNNakerExtraModelsPlugin are no longer required. These extra modules have been merged in to the main sPyNNaker module. You will be asked to uninstall these modules below if you have previously installed them, but will note that there are no instructions for installing a newer version.

Standard Central Installation

These instructions will install the required packages in a central location. If you are installing on Linux, you must have root access to do this (or prepend each command with sudo), and Windows users should run these commands from a command prompt run as Administrator (right-click the shortcut for the command prompt and select “Run as administrator” - without the sudo).

If you already have installed sPyNNaker previously (and the optional sPyNNakerExternalDevicesPlugin and/or sPyNNakerExtraModelsPlugin), you will need to uninstall it: [sudo] pip uninstall pyNN-SpiNNaker [sudo] pip uninstall sPyNNaker [sudo] pip uninstall sPyNNakerExternalDevicesPlugin [sudo] pip uninstall sPyNNakerExtraModelsPlugin

For PyNN 0.7 support:

  1. Install sPyNNaker7: [sudo] pip install "sPyNNaker7 == 1!4.0.0"
  2. Install pyNN-SpiNNaker: [sudo] python -m spynnaker7.pyNN.setup-pynn
  3. Install Matplotlib: [sudo] pip install matplotlib

For PyNN 0.8 support:

  1. Install sPyNNaker8: [sudo] pip install "sPyNNaker8 == 1!4.0.0"
  2. Install pyNN-SpiNNaker: [sudo] python -m spynnaker8.setup-pynn
  3. Install Matplotlib: [sudo] pip install matplotlib

You can now configure your environment.

User-only Installation

These instructions will install the required packages only for the current user (in your home directory). This can avoid issues where you don’t have root access to the machine you are installing on, or on a shared machine where the dependencies might otherwise conflict with those of other users.

If you already have installed sPyNNaker previously (and the optional sPyNNakerExternalDevicesPlugin and/or sPyNNakerExtraModelsPlugin), you will need to uninstall it: pip uninstall pyNN-SpiNNaker pip uninstall sPyNNaker pip uninstall sPyNNakerExternalDevicesPlugin pip uninstall sPyNNakerExtraModelsPlugin

For PyNN 0.7 support:

  1. Install sPyNNaker7: pip install "sPyNNaker7 == 1!4.0.0" --user
  2. Install pyNN-SpiNNaker: python -m spynnaker7.pyNN.setup-pynn
  3. Install Matplotlib: pip install matplotlib --user

For PyNN 0.8 support:

  1. Install sPyNNaker8: pip install "sPyNNaker8 == 1!4.0.0" --user
  2. Install pyNN-SpiNNaker: python -m spynnaker8.setup-pynn
  3. Install Matplotlib: pip install matplotlib --user

You can now configure your environment.

Virtualenv Installation

Follow these instructions to install the dependencies in a virtual environment.

If you already have installed sPyNNaker previously (and the optional sPyNNakerExternalDevicesPlugin and/or sPyNNakerExtraModelsPlugin), you will need to uninstall it:

  1. Activate your virtualenv, <name> source <name>/bin/activate
  2. Uninstall the existing tools pip uninstall pyNN-SpiNNaker pip uninstall sPyNNaker pip uninstall sPyNNakerExternalDevicesPlugin pip uninstall sPyNNakerExtraModelsPlugin

To install the tools, first, activate your virtualenv, <name>:

source <name>/bin/activate

For PyNN 0.7 support:

  1. Install sPyNNaker7: pip install "sPyNNaker7 == 1!4.0.0"
  2. Install pyNN-SpiNNaker: python -m spynnaker7.pyNN.setup-pynn
  3. Install Matplotlib: pip install matplotlib

For PyNN 0.8 support:

  1. Install sPyNNaker8: pip install "sPyNNaker8 == 1!4.0.0"
  2. Install pyNN-SpiNNaker: python -m spynnaker8.setup-pynn
  3. Install Matplotlib: pip install matplotlib

You can now configure your environment.

Configuration

When SpyNNaker is first called, if a configuration file is not found, it will create one in your home directory and exit. It is possible to ask SpyNNaker to do this before you run your first simulation as follows: python -c "import pyNN.spiNNaker"

Note that if you have previously installed a version of the spiNNaker software, you may already have a file called “.pacman.cfg” in your home directory. In this case, SpyNNaker will attempt to use this file for its paramters. If you don’t have this file, a new file called “.spynnaker.cfg” will be created in your home directory. You must edit this file to ensure that SpyNNaker can access your SpiNNaker machine. Upon opening this file, the part to alter will look like the following: [Machine] machineName = None version = None

If you have a SpiNNaker board, then go to Local Board if you do not have a SpiNNaker board, please follow the instructions in Instructions on how to use the different front ends in virtual mode and then go to Running some examples.

Local Board

Within the file, you should set machineName to the IP address or hostname of your SpiNNaker machine, and version to the version of your SpiNNaker board; this will almost certainly be “3” for a 4-chip board or “5” on a 48-chip board.

The default ip address for a spinn-3 board is 192.168.240.253 and the default ip address for a spinn-5 board is 192.168.240.1

now go to Network Configuration.

Network Configuration

  1. Go to the network settings for your computer and add or set an IPv4 entry with the following address for the adapter connected to the SpiNNaker board:
    1. ip address = 192.168.240.254
    2. sub-mask = 255.255.255.0
    3. default gateway = 0.0.0.0

Running some examples

  1. Download the examples:

  2. PyNN 0.7 Examples are here (zip) or here (tar.gz)
  3. PyNN 0.8 Examples are here (zip) or here (tar.gz)

  4. Extract the archive
  5. Go to the “examples” folder
  6. Run: python va_benchmark.py
  7. You will see the system go through a series of processes from partitioning, to placement, to routing and finally to loading and running.
  8. Once the example has finished, you should see a graph that will look something like this (for PyNN 0.7): VABenchmarkSpikes or this (for PyNN 0.8): VABenchmarkSpikes

If you get the output above, you have successfully installed your system.

Troubleshooting

  1. If you experience the error: **UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)**

Then to solve it, edit C:\Python27\Lib\mimetypes.py and add these codes:

if sys.getdefaultencoding() != 'gbk':
    reload(sys)
    sys.setdefaultencoding('gbk')

before the following line:

default_encoding = sys.getdefaultencoding()
  1. In OSX, if experiencing the following tkinter error:

_tkinter.TclError: no display name and no $DISPLAY environment variable

it may be solved by setting the backend for matplotlib. This can be done by editing the matplotlibrc file in the current working directory to read to backend: TkAgg. This is usually found in $DEV/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc In a virtualenv, create a new file in the root directory .matplotlib/matplotlibrc that reads backend: TkAgg. (Sample matplotlibrc file)