-
Notifications
You must be signed in to change notification settings - Fork 57
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
Preliminary MPI support for GeNN #158
Conversation
…the postsynaptic neurons Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
Signed-off-by: Mengchi Zhang <zhan2308@purdue.edu>
… and pull functions)
* ``NNmodel::isDeviceInitRequired`` checks for remote neuron groups who have outputs to local machine and have spike variables which should be initialised on device * ``genInitializeDeviceKernel`` now also intialises remote neuron group spike variables
…cal host which have delayed projections!
…of CPU_ONLY and MPI)
* Previously ``StandardGeneratedSections::neuronOutputInit`` was only being used in a subset of the locations this code was being run in * ``StandardGeneratedSections::neuronOutputInit`` should only advance device spike queues * For consistency all host spike queues are now advanced in stepTimeCPU/stepTimeGPU
I've now made these changes myself!
# Conflicts: # lib/GNUmakefile # lib/include/modelSpec.h # lib/src/generateRunner.cc
I have had a look at the example you made and had a bit of poking around.
would also allow something like
With the macros this would be difficult ... but maybe it's too late now to rethink the entire design? |
Argh ... maybe this is rubbish. The pull commands etc are also named at compile time, so what I was thinking wouldn't work anyway .... would it? |
I think those issues are kinda two sides of the same coin. Because the structure of the network exists largely as generated code in GeNN - rather than in Nest where it's builds in memory at runtime - I think it makes sense that the MPI code is more MIMD than would be typical. However I think the problem of not being able to loop through populations is more general than just MPI - the simulation code for the Potjans, Diesmann microcircuit (https://github.com/neworderofjamie/genn_examples/blob/master/potsjan_microcircuit/simulator.cc#L51-L114) is heading towards macro hell and that only has 8 populations. As you say there's not much choice as everything is compile-time. BUT I actually think the way the SpineML simulator works solves this quite neatly:
May be a good future direction for building the simulation code for larger GeNN models and the actual simulation executable would then be the same across all nodes, it just loads in a different dynamic library of generated code. |
This looks like an interesting solution. I remember back then there was a deliberate decision to make it all compile-time and have explicitly named functions for each population etc to make it easy for users not to have to index anything but only call things by name ... What is your gut feeling - is it worth just merging this solution (with the macros) now even if we may later do something more like the spineML2GeNN design? |
Well, all the options are there to build models using the SpineML approach (there's a GENN_PREFERENCE to build a dynamic library) so you would be able to build models like this using the current version. The example model is in my personal github so no one ever needs to see it :) I am keen to merge this PR into development to prevent it being lost (the MPI communications stuff and the splitting of remote and local populations are useful whatever), but perhaps I'll merge after I make the 3.1.0 release. Then I can experiment with building some models using the dynamic library approach and, if that's clearly a better fit for MPI, roll back some of the hacky bits for making filenames unique... |
Ok - you have my blessing to merge this when it fits into your workflow. Overall it's not an awful approach. That the macros exist doesn't hurt anyone who may not want to use them ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge when it suits best ... as discussed.
FYI @tnowotny I had a go at re-implementing the microcircuit model using a shared library here https://github.com/neworderofjamie/genn_examples/blob/master/potsjan_microcircuit/simulator_shared_library.cc. I think the result is already somewhat terser and less riddled with macros and there's still quite a lot of boilerplate that could be provided by the |
This now works pretty nicely as a very minimal MPI implementation for GeNN:
Essentially what's changed is:
NNmodel
now has seperate maps containing local and remote neuron groups - representing those simulated on the local machine and those simulated on other nodes on the network (which one a neuron group goes into is determined by the host id you pass toNNmodel::addNeuronGroup
)NNmodel
also has seperate maps of local and remote synapse groups (which one a synapse group goes into is automatically determined by the host id of it's target neuron group)NeuronGroup::hasOutputToHost
method which tests whether a neuron group has any outputs to a given host ID (MPI rank) - this is used to determine which remote neuron groups needs to be synchronised every time stepsynchroniseMPI
function which automatically sends and receives all required spikes each timestep.#ifndef POP_NAME_REMOTE
and e.g. not try and generate afferent connectivity .1 and 2 resulted in a fairly large number of search-and-replace changes but this nice thing with this is that 99% of the code just needs to work as before, just on the local neuron and synapse groups.
Example model using this is here https://github.com/neworderofjamie/genn_examples/tree/master/va_benchmark_mpi - it can run on a local MPI install or using the SGE system on our cluster.
NOTE I am going to merge this branch manually as I don't think the changes to the userprojects are useful