multiscale-cosim / EBRAINS-cosim

EBRAINS-cosim
Other
5 stars 0 forks source link

Epic: 2nd use-case. Analysis and breakdown into tasks #83

Open w-klijn opened 2 years ago

w-klijn commented 2 years ago
Aspect Detail
Summary Analysis and breakdown into tasks of Dennis's use-case
Assignee All
Information
Prerequisites
Dependencies

Summary

See detailed breakdown in comment

Tasks

Requirements

Acceptance criteria

w-klijn commented 2 years ago

It is the branch parallel, which I will try to keep stable for you to use: https://github.com/the-virtual-brain/tvb-multiscale/tree/parallel

The easiest way to run it is to build a Docker image by running the Dockerfile: https://github.com/the-virtual-brain/tvb-multiscale/blob/parallel/docker/Dockerfile and run the tool inside the image.

The Dockerfile itself with start a Jupiter environment, in which you can navigate to find the minimal example notebook WilsonCowanMinimal.ipynb: https://github.com/the-virtual-brain/tvb-multiscale/blob/parallel/examples/tvb_nest/notebooks/WilsonCowanMinimal.ipynb

Otherwise, you will have to built the environment using the Dockerfile for guidance...

tvb_multiscale uses a particular version of NEST from October 2020 , i.e., a few months before the release of 3.0. I have tried to use the NEST 3.0 release of June 7th, but after making all adjustments I got this error when running the TVB->NEST interface for a SERIAL cosimulation:

NESTErrors.BadProperty: BadProperty in SLI function SetStatus_id: Setting status of a 'inhomogeneous_poisson_generator' with node ID 51: Input parameters cannot be changed while inside a Prepare/Run/Cleanup context.

I need to modify the status of inhomogeneous_poisson_generator every synchronization_time, in order to send data from TVB to NEST. Apparently this is not possible any more. I would love to know if there is an alternative!

You can reproduce the error by trying to run the example notebook (see below) on this branch: https://github.com/the-virtual-brain/tvb-multiscale/tree/parallelNEST30

Moreover, tvb-multiscale uses a particular branch of tvb-root, where I have slightly modified and extended the “consensus” CoSimulator Lionel and I have arrived at: https://github.com/the-virtual-brain/tvb-root/tree/tvb-cosim-consensus-dp

In our meeting, I have shown you the TVB CoSimulator code that runs the (serial for the moment) co-simulation (by calling the NEST integration as well): https://github.com/the-virtual-brain/tvb-multiscale/blob/parallel/tvb_multiscale/core/tvb/cosimulator/cosimulator.py

Please notice:

the exit point of TVB -> NEST output: method _send_cosim_coupling at line 179

and the corresponding entry point of NEST -> TVB input: method _get_cosim_updates at line 170.

Also, I have shown you the basic TVBOutputInterfaces and TVBInputInterfaces that pick up (deliver) those output (input) data respectively from (to) TVB, by looping through the different interfaces (communication, transformation, communication pipelines): https://github.com/the-virtual-brain/tvb-multiscale/blob/parallel/tvb_multiscale/core/interfaces/tvb/interfaces.py Line 320 for the TVBOutputInterfaces and line 350 for the TVBInputInterfaces, see mainly the call() methods.

The example notebook WilsonCowanMinimal.ipynb is pretty similar to the WilsonCowan.ipynb. The main difference is that only 4 TVB brain regions are used, 2 of which modeled in NEST as spiking networks, whereas only 10 neurons per population are used, i.e., the model is downsized. Moreover, I have selected - for this minimal example - to demonstrate the more detailed user input versions, instead of using the dedicated builders for that specific WilsonCowan network example. However, I am not sure I can make it simpler, as it would be e.g., for a unit or simple integration test, because the structure of tvb-multiscale is very complex, and programmed in an object oriented manner. So, there are many layers between the user API and what happens behind the scenes...

Still, it is easy to see that the notebook isI split into the following subparts:

  1. General configuration of tvb-multiscale
  2. Building the TVB CoSimulator class
  3. Building the NEST Network assuming knowledge of the (serialized) TVB CoSimulator instance, including the TVB model’s parameters, the TVB connectome weights and delays etc.
  4. Building of the TVB <-> NEST Interfaces.
  5. CoSimulating
  6. Gathering outputs, minor analysis and data plotting.

Now, assuming that parts 1, 5 and 6 can be ignored for your purposes, and that parts 2 and 3 are meant to be independent scripts provided by the user, anyway, you can directly focus on part 4, where you can review:

Let’s meet, sometime after Wednesday, when you are available, so that I walk you through the notebook and its outputs. Then we can discuss what would be an even simpler or more minimal example, if possible.

lionelkusch commented 2 years ago

I don't know if this can help you but the following link is an example of my work where Nest 3 and TVB 2 are running together using their official release. https://github.com/lionelkusch/TVB-NEST/tree/nest-3_TVB_2

sdiazpier commented 2 years ago

I will submit a PR to remove this control in the stimulation device. This was added to match the current structure of the recording device, but it is not ok to have this for the stimulation devices.