Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Split blocks automatically #264
Loihi is organized into cores with a fixed number of compartments on each, and since the start we've required users to manually break their model into Ensembles that will each fit on one core.
This PR automates splitting larger ensembles to fit across multiple cores. This allows users to create the model in terms of structures that work well conceptually, and worry less about how that is going to map to Loihi.
There are two ways of using this functionality. One is to let
The second way to use block splitting is to provide instructions on how you (as a user) want an ensemble to be split. This is done via the
This PR also adds a number of features that we needed for a recent project.
Based on #261.
This commit introduces a new build step that splits blocks produced by the build process that would fail validation because they cannot fit on a single neuron core. Each large block is split into smaller blocks that can fit on a single neuron core. This happens automatically when a model fundamentally cannot be made to fit, which most commonly occurs when an ensemble has more than 1024 neurons. However, it can also be occur manually with the new `block_shape` Ensemble configuration option, which is added in `add_params`. This parameter accepts a `BlockShape` instance, which specifies how the ensemble should be split. See the `BlockShape` documentation for more details. Adding a new build step also added more complexity to the Simulator.__init__ method, so we moved many of the build-related steps that were previously in __init__ to the `build_network` function. In doing so, it is now harder to half-build a model, and the Simulator.__init__ method is less complex. Note that the block splitting process occurs before discretization, which means that this commit can change the behavior of existing models by specifying the `block_shape` of an ensemble; large models were not possible previously, so no existing models will change because blocks are only automatically split if they are too large to fit on one neuron core. We believe that doing discretization after splitting will only yield improvements, but we have not rigorously tested that belief. Co-authored-by: Trevor Bekolay <email@example.com>
This is required to allow probing across multiple blocks. Since this means that probes are not specific to one block, we should no longer consider them as part of a block, and instead the mental model is that they lie alongside the `LoihiInput` and `LoihiBlock` in the hierarchy of objects. So, a Loihi Model is a collection of `LoihiBlock`s that get input from `LoihiInput`s and get output from `LoihiProbe`s. Accordingly, we've renamed the `Probe` to `LoihiProbe` for consistency, and moved it a new top-level file, probe.py. Co-authored-by: Kinjal Patel <firstname.lastname@example.org> Co-authored-by: Trevor Bekolay <email@example.com>
The reason for not connecting can be any error that NxSDK throws when trying to connect, including problems with building the model, as well as actual connectivity problems. We now include the actual NxSDK error message in our error message to better inform users. Also reduce the number of connection attempts, since if it fails more than 3 times it's likely due to a model problem, not a connectivity problem.
Previously we ignored the case when they weren't installed, but raised other errors from having bad versions installed. We don't really care why they don't import, just that they don't, so now we ignore any issue with trying to import these.