Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example has error #118

Open
studywolf opened this issue Apr 4, 2016 · 5 comments
Open

example has error #118

studywolf opened this issue Apr 4, 2016 · 5 comments
Assignees

Comments

@studywolf
Copy link

indent should be removed after line 36, i believe! fix:

# Import modules
import csv
import numpy as np
import nengo
import nengo_spinnaker

# Import classes
from nengo.processes import WhiteNoise
from nengo_spinnaker.utils import profiling

# Parameters to profile
dimensions = 1
ensemble_size = 200

model = nengo.Network()
with model:
    # Create standard communication channel network with white noise input
    inp = nengo.Node(WhiteNoise(), label="inp")
    inp_p = nengo.Probe(inp)

    pre = nengo.Ensemble(ensemble_size, dimensions=dimensions, label="pre")
    pre_p = nengo.Probe(pre, synapse=0.01)
    nengo.Connection(inp, pre)

    post = nengo.Ensemble(ensemble_size, dimensions=dimensions, label="post")
    posts_p = nengo.Probe(post, synapse = 0.01)
    nengo.Connection(pre, post,
                     function=lambda x: np.random.random(dimensions))

    # Setup SpiNNaker-specific options to supply white noise from on
    # chip and profile the ensemble at the start of the channel
    nengo_spinnaker.add_spinnaker_params(model.config)
    model.config[inp].function_of_time = True
    model.config[pre].profile = True

# Create a SpiNNaker simulator and run model
sim = nengo_spinnaker.Simulator(model)
with sim:
    sim.run(10.0)

# Read profiler data
profiler_data = sim.profiler_data[pre]

# Open CSV file and create writer
with open("profile_communication_channel.csv", "wb") as csv_file:
    csv_writer = csv.writer(csv_file)

    # Write header row for CSV with extra columns
    # for number of neurons and dimensions
    profiling.write_csv_header(profiler_data, csv_writer,
                               ["Num neurons", "Dimensions"])

    # Write a row from the profiler data dollo
    profiling.write_csv_row(profiler_data, csv_writer,
                            [ensemble_size, dimensions])
@neworderofjamie
Copy link
Contributor

@studywolf, can you verify this fix works for you?

@studywolf
Copy link
Author

I'm just heading in to the office, should be able to verify in about 2-3 hours!

@bjkomer
Copy link

bjkomer commented Apr 8, 2016

When I run this I get an error in the write_csv_row function

Traceback (most recent call last):
  File "test_example.py", line 55, in <module>
    [ensemble_size, dimensions])
  File "/home/bjkomer/.local/lib/python2.7/site-packages/nengo_spinnaker-0.2.5-py2.7.egg/nengo_spinnaker/utils/profiling.py", line 54, in write_csv_row
    mean_times = [np.average(t[1]) for t in profiling_data.values()]
KeyError: 1

@neworderofjamie
Copy link
Contributor

Did you checked nengo spinnaker out from git (if so which branch are you on) or get it via pip?

@bjkomer
Copy link

bjkomer commented Apr 8, 2016

I checked it out from git, on the master branch.

mundya added a commit that referenced this issue Jun 9, 2016
As implemented by @neworderofjamie

Squashed commit of:

commit 0435762
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:52:48 2016 +0100

    Python 3

commit b90e219
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:49:54 2016 +0100

    pepepep

commit b9a818b
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:44:02 2016 +0100

    PEP8 and fixes

commit 2c60543
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:28:13 2016 +0100

    Already bored of build times - made scipy optional and imported it where it's used

commit c0cfe0e
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:17:57 2016 +0100

    Umm, dependency-resolution much!?!

commit 29ccde0
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:15:43 2016 +0100

    lapack

commit 302985e
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:12:29 2016 +0100

    Attempt alternative means of installing scipy

commit 1b674cf
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:10:13 2016 +0100

    Attempt to install scipy from apt-get (reverted from commit 9db5dfc)

commit 9db5dfc
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 13:08:09 2016 +0100

    Attempt to install scipy from apt-get

commit f4eda4a
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 12:26:05 2016 +0100

    Actually, for correctness, binned_statistic was present in 0.11 of SciPy

commit d893ee3
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 12:24:45 2016 +0100

    Scipy dependency

commit c539207
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 12:19:57 2016 +0100

    Binaries

commit 8a409d3
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 12:19:28 2016 +0100

    More tests

commit 4768040
Merge: f7ca695 d33c53e
Author: neworderofjamie <[email protected]>
Date:   Mon May 23 12:16:50 2016 +0100

    Merge remote-tracking branch 'origin/master' into new_ensemble-new_learning

    Conflicts:
    	nengo_spinnaker/binaries/nengo_ensemble.aplx
    	nengo_spinnaker/binaries/nengo_ensemble_profiled.aplx
    	nengo_spinnaker/binaries/nengo_filter.aplx
    	nengo_spinnaker/binaries/nengo_mc_player.aplx
    	nengo_spinnaker/binaries/nengo_rx.aplx
    	nengo_spinnaker/binaries/nengo_tx.aplx
    	nengo_spinnaker/binaries/nengo_value_sink.aplx
    	nengo_spinnaker/binaries/nengo_value_source.aplx
    	nengo_spinnaker/operators/lif.py
    	nengo_spinnaker/regions/__init__.py
    	nengo_spinnaker/regions/filters.py
    	nengo_spinnaker/regions/recording.py
    	nengo_spinnaker/simulator.py
    	spinnaker_components/ensemble/Makefile
    	spinnaker_components/ensemble/ensemble.c
    	spinnaker_components/ensemble/ensemble.h
    	spinnaker_components/ensemble/neuron_lif.h
    	spinnaker_components/filter/filter_main.c
    	spinnaker_components/value_sink/value_sink.c
    	tests/operators/test_lif.py
    	tests/regions/test_region_recording.py

commit f7ca695
Author: neworderofjamie <[email protected]>
Date:   Wed Apr 6 12:50:28 2016 +0100

    New executables built with spinnaker tools 2.0.0

commit 53965aa
Author: neworderofjamie <[email protected]>
Date:   Wed Apr 6 12:39:40 2016 +0100

    Updates to profile_communication_channel example including fix for #118

commit 7832e7e
Author: neworderofjamie <[email protected]>
Date:   Wed Apr 6 12:29:10 2016 +0100

    Update to spinnaker_tools 2.0.0

commit 58ddf1e
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 14 12:52:08 2016 +0000

    Mega-optimisation!

commit 0c3ec0c
Author: neworderofjamie <[email protected]>
Date:   Fri Jan 8 14:34:37 2016 +0000

    whole status is actually quite a lot more useful

commit 536d29e
Author: neworderofjamie <[email protected]>
Date:   Fri Jan 8 14:31:37 2016 +0000

    ahh shared memory, it works great when you read from it as well as writing

commit 4f9f4e9
Author: neworderofjamie <[email protected]>
Date:   Fri Jan 8 13:54:19 2016 +0000

    Input filters now get sliced - saves memory and doesn't break Voja implementation

commit e5b040f
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 15:13:56 2016 +0000

    region-size mismatch

commit 686f21e
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 15:13:29 2016 +0000

    use correct RTE code

commit 437fc16
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 14:43:20 2016 +0000

    Python side dma transfer of learnt signals

commit d33e3cb
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 14:42:59 2016 +0000

    actually run learn_associations on SpiNNaker backend...

commit e857616
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 14:42:39 2016 +0000

    Also show errors if application dies during runtime

commit c56051e
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 14:06:15 2016 +0000

    C-side extended DMA state machine

commit 13385c3
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 13:52:03 2016 +0000

    C-side data structures for dma transfer of learnt signals

commit ce9b6fe
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 13:51:38 2016 +0000

    Thanks @mundya - never actually hits exit

commit 31cccac
Author: neworderofjamie <[email protected]>
Date:   Thu Jan 7 10:51:12 2016 +0000

    Fix malloc_or_die

    Calls RT_ERROR to kill the core after a malloc fails.

commit 1d2c3a7
Author: neworderofjamie <[email protected]>
Date:   Wed Jan 6 15:59:36 2016 +0000

    Full encoder width should be used for top level partitioning

commit 98fc071
Author: neworderofjamie <[email protected]>
Date:   Wed Jan 6 12:36:35 2016 +0000

    Added additional constraint to SMULL instruction - otherwise (codesourcery) assigns sasme registers for output and input :(

commit 7b9571d
Merge: d9e95f4 e56c246
Author: neworderofjamie <[email protected]>
Date:   Tue Jan 5 18:17:55 2016 +0000

    Merge remote-tracking branch 'origin/recording_buffer_reset' into new_ensemble-new_learning

commit d9e95f4
Author: neworderofjamie <[email protected]>
Date:   Tue Jan 5 18:17:29 2016 +0000

    Improved handling of errors during simulation

commit e56c246
Author: neworderofjamie <[email protected]>
Date:   Tue Jan 5 18:12:57 2016 +0000

    Reset recording regions between simulation runs

commit 0f9bb8d
Author: jamie <[email protected]>
Date:   Mon Dec 28 18:46:14 2015 +0000

    Profiling tweaks
    * Re-implemented print-stats in terms of my new favourite function - scipy.stats.binned_statistic
    * Also used this rather than mean for writing CSV rows - generally rather more meaningful

commit 13287c8
Author: neworderofjamie <[email protected]>
Date:   Wed Dec 23 12:24:38 2015 +0000

    Spike recording didn't work on clustered ensembles

commit 52cf92e
Author: neworderofjamie <[email protected]>
Date:   Fri Dec 18 11:06:52 2015 +0000

    Extra PES tests

commit 016aa07
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 17 17:27:53 2015 +0000

    test learning rule probing

commit 9bcff4e
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 17 17:16:44 2015 +0000

    Encoder recording test

commit 9dbf316
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 17 16:28:44 2015 +0000

    Executables

commit 0cd4d6a
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 17 16:28:38 2015 +0000

    Voja tests

commit a4c1f41
Author: jamie <[email protected]>
Date:   Thu Dec 17 11:40:02 2015 +0000

    beginning of work on PES test - need advice from JH regarding how best to test slicing logic

commit 9607dad
Author: jamie <[email protected]>
Date:   Thu Dec 17 11:39:07 2015 +0000

    Caught bug in PESRegion (it's like testing works)

commit 2fa4034
Author: jamie <[email protected]>
Date:   Thu Dec 17 10:52:17 2015 +0000

    Learning rule connectivity builder tests

commit b34b4bd
Author: jamie <[email protected]>
Date:   Thu Dec 17 10:25:19 2015 +0000

    fixup existing tests, add some to cover learnt_slices etc

commit 7eea2e2
Author: jamie <[email protected]>
Date:   Thu Dec 17 10:24:56 2015 +0000

    Fix for numpy 1.8

commit 717041e
Author: jamie <[email protected]>
Date:   Wed Dec 16 18:30:51 2015 +0000

    Voja profiling

commit 5e24cd5
Author: jamie <[email protected]>
Date:   Wed Dec 16 13:21:50 2015 +0000

    correct SDRAM usage

commit 03918f8
Author: jamie <[email protected]>
Date:   Mon Dec 14 15:30:17 2015 +0000

    how the crap did that compile

commit be21a66
Author: jamie <[email protected]>
Date:   Mon Dec 14 14:08:32 2015 +0000

    fixed DTCM partitioning

commit 86becf5
Author: jamie <[email protected]>
Date:   Mon Dec 14 13:23:00 2015 +0000

    Profiling
    * Tidied up PES function a bit - just takes ensemble pointer rather than numerous parameters
    * Added profiler tags
    * Renamed skip() nop() as it resulted in some epically confusing errors
    * Added PES profiling tags

commit a9c3e0e
Author: jamie <[email protected]>
Date:   Mon Dec 14 11:23:39 2015 +0000

    write voja-learnt encoder to write location!

commit b25365a
Author: jamie <[email protected]>
Date:   Mon Dec 14 10:11:07 2015 +0000

    Re-figured out matplotlib animation and made animated encoder plot

commit a79cc3e
Author: jamie <[email protected]>
Date:   Fri Dec 11 12:32:44 2015 +0000

    Re-added total encoder width parameter - recorded encoders now don't look TOTALLY trashes

commit 101d361
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 16:58:28 2015 +0000

    Small bug fixes in scaled encoder recording - still doesn't actually work

commit d9a6ed7
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 16:17:26 2015 +0000

    Examples that can be removed from here before merging, but I want to not lose this time :)

commit 7103e0a
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 15:26:36 2015 +0000

    pep8

commit 82d3cb5
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 15:18:36 2015 +0000

    Correct slicing of PES learning

commit 2c0ce8f
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 12:32:43 2015 +0000

    Python side of working Voja
    * Seperate decoders and keys regions for learnt and static decoders
    * Static and learnt output space partitioned seperately
    * 'Properly' disabled filtered activity mode

commit 3fea698
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 10 12:30:54 2015 +0000

    c-side of functioning PES
    * ensemble.parameters hampers anything approximating 80 character lines - assigned to params in a bunch of places
    * Seperate learnt and static decoder and keys regions concatenated when loaded so existing static processing can be employed

commit cdebc38
Author: neworderofjamie <[email protected]>
Date:   Wed Dec 9 16:25:52 2015 +0000

    New C implementation of non-filtered PES

commit 6b43f69
Author: neworderofjamie <[email protected]>
Date:   Wed Dec 9 13:43:28 2015 +0000

    Small bits of python learning which failed to merge

commit 5b29214
Author: neworderofjamie <[email protected]>
Date:   Wed Dec 9 13:43:03 2015 +0000

    * decode_spike_train doesn't belong in the header - Discuss!
    * looping on n suggests neurons which made me more confused than seemed necessary
    * PES can't be updated in simulate_neurons

commit 6448dca
Author: neworderofjamie <[email protected]>
Date:   Fri Dec 4 11:14:57 2015 +0000

    Most of c-code integrated - still needs more thought in places
    * Filtered activity basically disabled

commit 302d31a
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 11:33:25 2015 +0000

    flake8

commit e9c2db7
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 11:23:25 2015 +0000

    Tidying of include guards #includes to match new names post-rename

commit c9bd1b0
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 11:18:05 2015 +0000

    Renames of c files

commit 3801cad
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 11:13:40 2015 +0000

    Renamed EnsembleRegions to Regions for terseness - discuss!

commit 67edf4d
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 11:02:06 2015 +0000

    Python side of encoder learning

commit 800a3b3
Author: neworderofjamie <[email protected]>
Date:   Thu Dec 3 10:34:38 2015 +0000

    Python side of learning rule re-integration
    * ConnectionMap.get_signals_from_object builds a DEFAULTdict of lists
    * ReceptionParams and TransmissionParams contain reference to learning rule

commit 0e05a33
Author: neworderofjamie <[email protected]>
Date:   Tue Dec 1 17:07:30 2015 +0000

    Updated ensemble builder to use new semantics

commit 4a34ddc
Author: Andrew Mundy <[email protected]>
Date:   Mon Oct 12 15:52:43 2015 +0100

    Shared memory ensembles

    Use SDRAM to reduce the communication load presented by Ensembles.  Each
    Ensemble in a `cluster` writes its spike vector into SDRAM and is then
    responsible for decoding a subspace of the entire output space.

commit 497fe48
Author: Andrew Mundy <[email protected]>
Date:   Mon Oct 12 15:52:43 2015 +0100

    Shared memory ensembles

    Use SDRAM to reduce the communication load presented by Ensembles.  Each
    Ensemble in a `cluster` writes its spike vector into SDRAM and is then
    responsible for decoding a subspace of the entire output space.

    Includes suggestions by @neworderofjamie

commit 67bc0af
Author: Andrew Mundy <[email protected]>
Date:   Thu Oct 15 20:32:26 2015 +0100

    Make Region.sizeof_padded use args, kwargs

    This makes the API more flexible.

commit 7ef8a11
Author: Andrew Mundy <[email protected]>
Date:   Sat Dec 5 10:55:34 2015 +0000

    Expand partitioning to deal with multiple slices

    Creates a new `partition_multiple` tool for partitioning multiple slices
    simultaneously; the original `partition` function is rewritten as a
    wrapper for this new function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants