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

Add infrastructure for generic input backends to feed devices #1456

Merged
merged 178 commits into from
Jun 9, 2021

Conversation

sdiazpier
Copy link
Contributor

@sdiazpier sdiazpier commented Mar 6, 2020

This PR adds the infrastructure required for the input part of NESTio.


See #1283 for the RecordingBackend counterpart of the NESTio infrastructure.

@jougs jougs changed the title Nest I Add infrastructure for generic input backends to feed devices Mar 10, 2020
@jougs jougs self-requested a review March 10, 2020 09:42
@jougs jougs added ZC: Kernel DO NOT USE THIS LABEL I: Behavior changes Introduces changes that produce different results for some users ZP: PR Created DO NOT USE THIS LABEL S: High Should be handled next T: Enhancement New functionality, model or documentation labels Mar 10, 2020
@jougs jougs added this to the NEST 3.0 milestone Mar 10, 2020
@terhorstd terhorstd requested a review from hakonsbm March 16, 2020 10:55
Copy link
Contributor

@hakonsbm hakonsbm left a comment

Choose a reason for hiding this comment

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

Thank you for this great addition! I have quite a few suggestions, but there are a lot of similar ones, and all of them are minor.

models/spike_generator.cpp Outdated Show resolved Hide resolved
models/spike_generator.cpp Outdated Show resolved Hide resolved
models/spike_generator.cpp Outdated Show resolved Hide resolved
models/spike_generator.h Outdated Show resolved Hide resolved
nestkernel/input_backend_internal.cpp Outdated Show resolved Hide resolved
nestkernel/input_backend_mpi.cpp Outdated Show resolved Hide resolved
nestkernel/input_backend_mpi.cpp Outdated Show resolved Hide resolved
models/spike_generator.h Outdated Show resolved Hide resolved
nestkernel/input_device.h Outdated Show resolved Hide resolved
nestkernel/input_device.h Outdated Show resolved Hide resolved
@sdiazpier
Copy link
Contributor Author

Thank you dear @hakonsbm we will work on these corrections right away.

@lionelkusch
Copy link
Contributor

Thank you @hakonsbm for all requests. @sdiazpier and me fix all of this.
If you have new requests don't hesitate to ask them.

@heplesser heplesser removed ZC: Kernel DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL labels Apr 7, 2020
Copy link
Contributor

@hakonsbm hakonsbm left a comment

Choose a reason for hiding this comment

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

@sdiazpier @lionelkusch Thanks for the changes! Just a few more and I'm happy.

nestkernel/io_manager.cpp Outdated Show resolved Hide resolved
nestkernel/recording_backend_mpi.cpp Outdated Show resolved Hide resolved
nestkernel/input_backend.h Outdated Show resolved Hide resolved
nestkernel/io_manager.h Show resolved Hide resolved
Copy link
Contributor

@jougs jougs left a comment

Choose a reason for hiding this comment

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

During NESTio/Output, all recorders were refactored to be derived from RecordingDevice instead of having one as a member. The base class RecordingDevice is now deriving from DeviceNode and Device.

During the work on this PR, a new base class InputDevice was introduced to handle the stimulus data coming from a backend instead of from parameter data members in the concrete stimulator class. I propose several changes:

  • A refactoring along the lines of the one described above would simplify the design. Namely, making StimulatingDevice a base class of the concrete stimulator.

  • To further simplify the design, the functionality of the new base class InputDevice should be included into the StimulatingDevice class.

  • The base class for recording backends was first called OutputBackend. We decided to rename them to RecordingBackends to make clear that they are not backends for general output operations from within NEST, but only handle the output generated by recorders. The same considerations apply to the naming of the current InputBackend base class, which IMO should be renamed to StimulatingBackend

  • The derivation of the SpikeParameters_ struct from the class Parameters_, which is a nested member of the InputDevice base class, looks unusual to me. I have not looked into this in detail, but think that a mechanism using get_/set_status() should be used instead and would result in a cleaner design. The same considerations apply to the State_ struct.

  • Why is the InputBackendInternal needed at all if it does nothing? Couldn't an empty input_from field just be interpreted in this way?

  • The InputBackend base class is currently more or less a copy of the RecordingBackend, which raises a number of questions:

    • The documentation is still mostly describing the design and workings of the recording backend infrastructure with just the word "recording" replaced by "input".

    • I don't understand how some of the interface functions that were taken from the recording backend design are actually useful for the input side.

      • One example is set_value_names(). If I understand the code correctly, all assignments of incoming data to device member variables is solely handled by update_from_backend() inside of the concrete stimulator and backends don't have to know about the data layout or field names at all.

      • I don't quite see how all the hooks are useful for the input side. In my view an input backend receives data from somewhere once per cycle and has to hand that over to all enrolled devices without the need for a more fine grained flow control. If I'm wrong, possible use cases should be explained in the documentation of the corresponding interface functions in the base class for input backends.

  • In general, some things should be renamed from my point of view:

    • input_fromstimulus_source or data_source
    • MPIFilePortsUnknownMPIPortsFileUnknown
    • The name of the function update_from_backend() is misleading, as the update() function of nodes in NEST is used to propagate their state once every time cycle. A better name would be set_data_from_input_backend() or something similar.

nestkernel/exceptions.h Outdated Show resolved Hide resolved
nestkernel/input_backend_mpi.h Outdated Show resolved Hide resolved
nestkernel/exceptions.cpp Outdated Show resolved Hide resolved
nestkernel/exceptions.h Outdated Show resolved Hide resolved
nestkernel/exceptions.h Outdated Show resolved Hide resolved
nestkernel/exceptions.h Outdated Show resolved Hide resolved
nestkernel/input_backend_mpi.cpp Outdated Show resolved Hide resolved
models/spike_generator.cpp Outdated Show resolved Hide resolved
@lionelkusch
Copy link
Contributor

cc @maedoc

@jougs
Copy link
Contributor

jougs commented Jul 13, 2020

@lionelkusch, @sdiazpier: can you please give a short update of the status? Many thanks!

@jougs
Copy link
Contributor

jougs commented Aug 10, 2020

This is just a friendly ping!

@sdiazpier
Copy link
Contributor Author

Dear @jougs we are still working on details merging the stimulating device with the input device. However, the more simple things we have mostly addressed already:

  • Making StimulatingDevice a base class of the concrete stimulator -> Done

  • To further simplify the design, the functionality of the new base class InputDevice should be included into the StimulatingDevice class.-> Problematic, in progress

  • The base class for recording backends was first called OutputBackend. We decided to rename them to RecordingBackends to make clear that they are not backends for general output operations from within NEST, but only handle the output generated by recorders. The same considerations apply to the naming of the current InputBackend base class, which IMO should be renamed to StimulatingBackend -> Done

  • Refactoring of SpikeParameters_ struct and State_ struct. -> Done

  • Why is the InputBackendInternal needed at all if it does nothing? Couldn't an empty input_from field just be interpreted in this way? -> In progress

  • The InputBackend base class is currently more or less a copy of the RecordingBackend, which raises a number of questions:

    • The documentation is still mostly describing the design and workings of the recording backend infrastructure with just the word "recording" replaced by "input". -> Done
    • I don't understand how some of the interface functions that were taken from the recording backend design are actually useful for the input side. -> Removed set_value_names() and unnecessary hooks.
  • Renaming:

  • input_from ⟶ stimulus_source or data_source -> Done to stimulus_source
  • MPIFilePortsUnknown ⟶ MPIPortsFileUnknown -> Done
  • Change name of function update_from_backend() to set_data_from_input_backend() -> Done to set_data_from_stimulating_backend()

As soon as we finalize the open points we will update the PR.

@jougs
Copy link
Contributor

jougs commented Aug 10, 2020

Awesome! Many thanks for the update and all the work in the background :-)

Copy link
Contributor

@jougs jougs left a comment

Choose a reason for hiding this comment

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

Thanks for your changes! Here are three more comments.

Pleas consider using the "batch commit" feature in the "Files Changed" pane in the future. That way you could bundle multiple suggestions into a single commit and also reduce the number of notification mails sent by GitHub. Thanks!

nestkernel/recording_backend_mpi.h Outdated Show resolved Hide resolved
nestkernel/stimulating_backend.h Outdated Show resolved Hide resolved
nestkernel/stimulating_backend_mpi.h Show resolved Hide resolved
@sdiazpier
Copy link
Contributor Author

Dear @jougs about the diagrams, communication_Nest.pdf, Nest_IO.pdf and state_Nest.pdf, where would it be good to store them so we can reference from the developer documentation?
I hope all the other comments are now solved :)

@jougs
Copy link
Contributor

jougs commented May 17, 2021

@sdiazpier, many thanks. All my suggestions are addressed!

Regarding the diagrams: @jessica-mitchell, what would be an appropriate location for such static content of the developer documentation? I tend to think that doc/devdoc/static would look nice alongside the already existing doc/userdoc/static. In any case, the Doxyfiles would have to be configured (and tested) accordingly, as this is the first time that we have custom files to be included in the developer documentation.

@lionelkusch
Copy link
Contributor

Dear @jougs and @jessica-mitchell,
These are the image in png format to add to the Nest documentation :
communication_Nest
state_Nest
Nest_IO

@jougs
Copy link
Contributor

jougs commented May 21, 2021

I would appreciate if the figures were added also in a vector format or any source format they were generated from. The rationale for this is that we might need to tweak the figures in the future. I suggest to add them to doc/devdoc/static for the time being.

I would be OK with approving this without more extensive developer documentation, but would like to see at least some basic information about the idea on the user level stimulation guide. Also the links to the MPI backend documentation in the recording and stimulation guides are needed, so they can actually be found.

After reviewing #1929, I think we also need a section on the availability of the Stimulating Backend infrastructure in the NEST 2->3 guide. @jessica-mitchell, can you please give a hint on where this should best go?

@jessica-mitchell
Copy link
Contributor

@jougs I'd suggest if it's a user level document to highlight the new feature, it should go here: doc/userdoc/guides/nest2_to_nest3/nest3_features/or put it in doc/userdoc/guides/ if it's much more in-depth and detailed. And include a link here doc/userdoc/guides/nest2_to_nest3/nest3_features/index.rst which also contains links to:

  • New functionality for node handles (neurons and devices)
  • New functionality for handling connections (synapses)
  • Parametrization
  • Simpler handling of random number generators
  • Recording from simulations
  • NEST Server

Also the devdoc/static sounds fine to me too

Add images for develloper documentation and add it in doxygen
documentation.
Add files from UMLET which generate the image.

Modification of documentation of stimulus and recording with MPI
backend for user documentation.
@lionelkusch
Copy link
Contributor

Hi @jougs,
I include the images in the format of svg and integrate them in the developer documentation. I also include the xml file used by UMLET for generated these images.
I modify the documentation for including the modification of Nest 3 and the usage of this new backend, following the remarks.

@sdiazpier : Can you take a short look to check if I am not missing something?

@sdiazpier
Copy link
Contributor Author

Dear @lionelkusch thanks so much for adding the figures and documentation. Dear @jougs I think we are ready for your final checks. Hopefully everything is now covered.

@jougs
Copy link
Contributor

jougs commented Jun 8, 2021

@lionelkusch, @sdiazpier: Many thanks!

I have just sent a PR towards your branch, in which I mostly reworked the structure of the user level documentation. I think you don't have to look into it in detail, as I already discussed most changes with @jessica-mitchell and @terhorstd. Once that's merged, I'll merge this one.

* Added epsilon to position checks

Because of round-off errors when comparing node positions to lower left and upper right.

* Removed unnecessary preprocessor directive

* Added documentation on parameter comparators

* Added test of round-off errors when connecting spatial populations

* Added comments on epsilon values

* Clarified a sentence

* Fixed regex to correctly catch warnings

* Updated return statements that are used in only rare cases

* Added warnings from random123 library to known warnings

* Fixed warning for implicitly declared operator=()

* Fixed warning for unordered initialization of variables

* Fixed warning for comparison of unsigned variable >= 0

* Fixed warnings from MUSIC models

* Using a negative epsilon value for the other comparison as well

* Apply suggestions from code review

Co-authored-by: jessica-mitchell <[email protected]>

* Apply suggestions from code review

Co-authored-by: Hans Ekkehard Plesser <[email protected]>

* Formatting

* Updated return values in docstring

* Add renamed 'time' to 'biological_time' kernel status variable

* fix renamed 'time' to 'biological_time' kernel status variable

* add colour highlighting to NEST 3.0 guide

* fix rST syntax

Co-authored-by: Håkon Bakke Mørk <[email protected]>

* Rework stimulating device/backend documentation

The purpose of this commit is to make the documentation of
stimulating devices/backends more consistent with that of
recording devices/backends. It also updates the corresponding
guides.

* Fix formatting

* Fix formatting

* Fix reordering warning

Co-authored-by: Håkon Mørk <[email protected]>
Co-authored-by: jessica-mitchell <[email protected]>
Co-authored-by: Hans Ekkehard Plesser <[email protected]>
Co-authored-by: clinssen <[email protected]>
Co-authored-by: C.A.P. Linssen <[email protected]>
Co-authored-by: Stine Brekke Vennemo <[email protected]>
@sdiazpier
Copy link
Contributor Author

Dear @jougs and everyone involved in the PR, I just merged your changes to our branch. Thanks so much for the revised documentation.

Copy link
Contributor

@jougs jougs left a comment

Choose a reason for hiding this comment

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

Also many thanks from my side for all the hard work!

@jougs jougs merged commit 126616b into nest:master Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: Behavior changes Introduces changes that produce different results for some users S: High Should be handled next T: Enhancement New functionality, model or documentation
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants