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

Region downloading #1474

Merged
merged 14 commits into from
Sep 9, 2024
Merged

Region downloading #1474

merged 14 commits into from
Sep 9, 2024

Conversation

rowleya
Copy link
Member

@rowleya rowleya commented Aug 1, 2024

Copy link
Member

@Christian-B Christian-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle I approve these changes.

What worries me is that to trigger recording there is a script level addition to trigger the "download_synapses". This is less than ideal but I can not think of a clean solution to trigger this for only a few projections.

However I can not find a similar level call to get the data,

I see it in the data.sqlite3 file but there is not way to get it back to script level.

Which means the test only ask for it but never check it was recorded read back let alone correct

@Christian-B
Copy link
Member

Christian-B commented Aug 16, 2024

Fails if you download_synapses on two (or more) projections into the same target vertex

    sim.setup(timestep=1.0, n_boards_required=1)
    pop = sim.Population(1, sim.IF_curr_exp(), label="pop_1")
    input_pop = sim.Population(
        1, sim.SpikeSourceArray(spike_times=[0]), label="input")
    sim.Projection(input_pop, pop, sim.OneToOneConnector(),
                   synapse_type=sim.StaticSynapse(weight=5, delay=1),
                   download_synapses=True)
    sim.Projection(input_pop, pop, sim.OneToOneConnector(),
                   synapse_type=sim.StaticSynapse(weight=5, delay=1),
                   download_synapses=True)
    pop.record(["spikes", "v"])
    sim.run(10)

The problem actually was not the two or more projections but the overlap between ids.

fixed by using recordable_variables

@Christian-B
Copy link
Member

I see that SynapticMatrixApp. get_connections (called indirectly from Projection.get) tries to read back the data saved.

This works fine if the simulation is just run once.
But then I am not sure what the benefit is other than the raw data is available in the database.

However this fails if the simulation is run multiple times.

sim.setup(timestep=1.0, n_boards_required=1)
pop_1 = sim.Population(1, sim.IF_curr_exp(), label="pop_1")
input_pop = sim.Population(
    1, sim.SpikeSourceArray(spike_times=[0]), label="input")
input_proj = sim.Projection(input_pop, pop_1, sim.OneToOneConnector(),
                            synapse_type=sim.StaticSynapse(weight=5, delay=1)
                            , download_synapses=True
                            )
pop_1.record(["spikes", "v"])
simtime = 10
sim.run(simtime)
sim.run(simtime)

con = input_proj.get(["weight","delay"], "list")
print(con)


print is
([0, 0, 5.0, 1.0], [1, 0, 5.0, 1.0])

--
The reason is the bufferExtractor is run at the end of each run (or auto pause resume loop)
The data for the region is added each time.
(In Database terms it is addred to the RegionExtra) table

So in the above example the block of data passed to convert_to_connections is twice as log as expected and this confused the function.

@rowleya
Copy link
Member Author

rowleya commented Aug 22, 2024

To answer some questions:

  • You are right that you have to specify the "download_synapses" option to make this work. This is because I didn't want to pre-download all synapses just in case they were wanted; most simulations don't want to read the synapses back, so this would be wasteful. Instead, this flag is used to indicate synapses that are wanted, and so these are downloaded using the "fast data read" protocol. Note that reading back synapses without the flag should still work, it is just that they will be "slow" downloaded.
  • The downloading could be altered so metadata is used once and the downloading actually happens when the call is made rather than pre-emptively. This could then be used for recording downloading too.
  • You are right that mutliple runs will fail because things get extended. This will either need changing as specified above (one off metadata and clear) or else the region needs to be cleaned immediately once read or once simulation restarts (probably easier but not sure).

@Christian-B Christian-B merged commit 6f5420e into master Sep 9, 2024
13 checks passed
@Christian-B Christian-B deleted the region_downloading branch September 9, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants