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

Make neurons from Decision Making tutorial much faster with GraphDynamics #484

Merged
merged 8 commits into from
Nov 5, 2024

Conversation

MasonProtter
Copy link
Contributor

@MasonProtter MasonProtter commented Nov 4, 2024

So this does away with the composite events for the LIFExci and LIFInh neurons, and the connection-based events that I was originally using, in favour of a new concept where each event is given an object foreach_connected_neuron which can be used to apply a function to every downstream connected neuron from a given neuron.

This turns out to be much faster than what I was doing before. For example, before I had something like

julia> decision_making_bench(N_E=100; mtk=false, parallel=true)
GraphDynamics.jl Serial:        
  time to construct Problem:   0.432885 seconds (4.14 M allocations: 199.099 MiB)
  time to first solve:        84.367572 seconds (91.81 M allocations: 6.094 GiB, 2.62% gc time)
  compiled solve time:        83.887199 seconds (91.81 M allocations: 6.094 GiB, 2.17% gc time)

GraphDynamics.jl Parallel:  
  time to first solve:        71.096560 seconds (307.66 M allocations: 26.199 GiB, 9.28% gc time, 16.55% compilation time)
  compiled solve time:        58.812354 seconds (260.36 M allocations: 23.974 GiB, 10.07% gc time)

vs after:

julia> decision_making_bench(N_E=100; tspan=(0.0, 30.0), mtk=false, parallel=true)
GraphDynamics.jl Serial:        
  time to construct Problem:   0.126195 seconds (1.61 M allocations: 82.515 MiB)
  time to first solve:         3.096629 seconds (5.27 M allocations: 441.201 MiB, 1.79% gc time, 13.37% compilation time: 100% of which was recompilation)
  compiled solve time:         2.810533 seconds (4.25 M allocations: 389.574 MiB, 6.47% gc time)

GraphDynamics.jl Parallel:  
  time to first solve:        13.001428 seconds (55.67 M allocations: 3.094 GiB, 6.22% gc time, 87.11% compilation time)
  compiled solve time:         1.733313 seconds (9.26 M allocations: 933.787 MiB, 9.55% gc time)

This PR requires Neuroblox/GraphDynamics.jl#10 and Neuroblox/GraphDynamics.jl#9 which should be on the general registry as v0.2.0 soon.


Edit:

julia> decision_making_bench(N_E=1500; tspan=(0.0, 30.0), mtk=false, parallel=true)
GraphDynamics.jl Serial:        
  time to construct Problem:  33.021983 seconds (259.92 M allocations: 11.507 GiB, 19.54% gc time)
  time to first solve:       742.163511 seconds (98.22 M allocations: 8.721 GiB, 0.28% gc time)
  compiled solve time:       744.091654 seconds (98.22 M allocations: 8.721 GiB, 0.24% gc time)

GraphDynamics.jl Parallel:  
  time to first solve:       155.421290 seconds (105.55 M allocations: 9.543 GiB, 1.21% gc time)
  compiled solve time:       158.298079 seconds (105.55 M allocations: 9.543 GiB, 1.12% gc time)

@MasonProtter MasonProtter merged commit 3b9221d into master Nov 5, 2024
6 checks passed
@MasonProtter MasonProtter deleted the mp/make_LIFExci_and_LIFInh_faster branch November 5, 2024 16:22
david-hofmann pushed a commit that referenced this pull request Nov 11, 2024
…mics (#484)

* remove soem junk

* more junk

* switch to using `ForeachConnectedSubsystem` instead of composite events

* make connections subtypes of ConnectionRule

* allow skipping building `ODESystem`

* bump GraphDynamics compat

* remove more unused comments
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

Successfully merging this pull request may close these issues.

1 participant