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

The simulations freeze when the number of neuron in a population is lower than the number of MPI processes #767

Open
RCagnol opened this issue Jan 2, 2023 · 2 comments
Milestone

Comments

@RCagnol
Copy link

RCagnol commented Jan 2, 2023

I noticed that in PyNN 0.10.1 the simulations freeze when the number of MPI node exceedes the number of neurons in a population. This wasn't happening in PyNN 0.10.0.

For example the following code freezes when the number of MPI process is higher than 2:

import pyNN.nest as sim
n_neurons = 2
node_id = sim.setup(timestep=0.1, min_delay=0.1, max_delay=100)
neurons = sim.Population(n_neurons, sim.IF_cond_exp())
neurons.record(['spikes','v', 'gsyn_exc','gsyn_inh'])
sim.run(100.0)
block = neurons.get_data(['spikes', 'v', 'gsyn_exc', 'gsyn_inh'],clear=True)

The MPI nodes to which no neurons are assigned seems to reach the call to gather here: https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/recording/__init__.py#L73

While the MPI nodes to which some neurons are assigned seem to freeze before that, when trying to access to self._simulator.state.t in different parts of the _get_current_segment() method ( https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/recording/__init__.py#L269 )

I didn't manage to figure out what is exactly causing that, but it seems that in the same method, displacing the following lines:

t_start = self._recording_start_time
t_stop = self._simulator.state.t * pq.ms
sampling_period = self.sampling_interval * pq.ms
current_time = self._simulator.state.t * pq.ms

before the if signal_array.size > 0: condition (which was the case in PyNN 0.10.0) seems somehow to solve the issue.

@apdavison apdavison added this to the 0.10.2 milestone Jan 31, 2023
@apdavison
Copy link
Member

probably related to #657

@apdavison apdavison modified the milestones: 0.10.2, 0.11.0 Feb 5, 2023
@RCagnol
Copy link
Author

RCagnol commented May 23, 2023

It seems that the issue is caused by the fact that only some of the MPI processes try to access to self._simulator.state.t. Indeed, it seems that Nest freezes when only some MPI nodes access to nest.biological_time.

For example, the following nest code freezes when ran with mpirun -n 2

from mpi4py import MPI
mpi_comm = MPI.COMM_WORLD
import nest
if mpi_comm.rank == 0:
    nest_time = nest.biological_time
    print(nest_time)

@apdavison apdavison modified the milestones: 0.11.0, 0.13.0 Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants