Skip to content

Conversation

babsey
Copy link
Contributor

@babsey babsey commented May 7, 2025

When executing simulation via nest-server-mpi, the result seems not correctly.

In fact, when using a number of processes greater than 1, lets say an example np = 3.
It shows only activity of each 3rd neuron.

It seems that we need to merge the responses of nest-server-mpi.

With this PR, NEST Desktop shows activity of all neurons executed on nest-server-mpi.

@babsey babsey force-pushed the nest-server-mpi-merge-responses branch from 78404ae to 909e5eb Compare May 7, 2025 13:45
@babsey babsey changed the title Fix merging responses in nest-server-mpi Fix merging responses in nest-server-mpi May 7, 2025
@babsey babsey self-assigned this May 9, 2025
@babsey babsey added this to PyNEST May 19, 2025
@github-project-automation github-project-automation bot moved this to In progress in PyNEST May 19, 2025
@gtrensch gtrensch added T: Bug Wrong statements in the code or documentation S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Jun 2, 2025
@gtrensch gtrensch moved this from To do to Review in Installation Jun 2, 2025
@heplesser heplesser added S: High Should be handled next and removed S: Normal Handle this with default priority labels Jun 30, 2025
Copy link
Contributor

@steffengraber steffengraber left a comment

Choose a reason for hiding this comment

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

+1 The logic seems perfectly correct to me. Robustness could be increased by additional checks of values and lists. But only if necessary.

@babsey
Copy link
Contributor Author

babsey commented Jul 7, 2025

I am working on better solution of combine function.

Thank you for the patience.

Copy link
Contributor

@heplesser heplesser left a comment

Choose a reason for hiding this comment

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

Overall this looks good to me, but I think docstrings for the new methods would be an advantage for long-term maintenance of the code.

@github-project-automation github-project-automation bot moved this from In progress to Review in PyNEST Jul 10, 2025
@babsey babsey changed the base branch from master to rc July 11, 2025 09:29
@babsey babsey changed the base branch from rc to master July 11, 2025 09:29
@gtrensch gtrensch requested a review from heplesser July 25, 2025 07:06
@terhorstd terhorstd requested review from gtrensch and removed request for heplesser July 28, 2025 09:55
@babsey babsey changed the base branch from master to ubuntu-version-bump July 28, 2025 10:46
@babsey babsey changed the base branch from ubuntu-version-bump to master July 28, 2025 10:46
@heplesser heplesser removed the request for review from gtrensch August 7, 2025 13:48
Copy link
Contributor

@heplesser heplesser left a comment

Choose a reason for hiding this comment

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

@babsey Thanks for the update. I still have some issues, see inline comments.

* for some specific calls, the responses are known to be the
same from the master and all workers. In this case, the
combined response is just the master response
be None.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since all bullet points begin with lowercase letters, all bullets except the last should end with ;

Comment on lines +564 to +566
* the responses are known to be the same from the master and all
workers. In this case, the combined response is just the master
response.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid loaded terms such as "master" and "workers". All MPI ranks in a NEST simulation are doing the same work, just on different parts of the network. Also, how would it be "known" that we get the same response from each rank?

Comment on lines +570 to +571
* if the response contains one list per process, the combined
response will be those first list.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this, especially the "those first list". If I get one list from each rank and the data fall not under the "same from all" clause above, don't I need to combine the lists from all ranks?

if len(filtered_response) == 1:
return filtered_response[0]
# return first list/tuple if the response only consists of lists or tuples.
elif all(type(v) in [list, tuple] for v in response):
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't

Suggested change
elif all(type(v) in [list, tuple] for v in response):
elif all(isinstance(v, (list, tuple)) for v in response):

be more elegant?

def merge_dicts(response):
"""Merge status dictionaries of recorders
def merge_dicts(response: list[dict]) -> dict:
"""Merge dictionaries of the response.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you removing the documentation below. merge_dicts() seems to do rather complex things depending on the structure of its input. Without a docstring explaining what the intended result is for the different cases, I find it difficult to review the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Bug Wrong statements in the code or documentation
Projects
Status: Review
Status: Review
Development

Successfully merging this pull request may close these issues.

4 participants