-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Labels
I: No breaking changePreviously written code will work as before, no one should note anything changing (aside the fix)Previously written code will work as before, no one should note anything changing (aside the fix)S: HighShould be handled nextShould be handled nextT: BugWrong statements in the code or documentationWrong statements in the code or documentation
Description
Describe the bug
When I try to connect neurons only within a single mpi rank with nest.Connect, the next call to nest.Simulate will block.
To Reproduce
Run mpirun -n 2 python3 nest-bug.py
Program: nest-bug.py
import nest
if __name__ == '__main__':
number_ranks = nest.NumProcesses()
my_rank_nest = nest.Rank()
print("I am rank", my_rank_nest, "out of", number_ranks)
nest.ResetKernel()
nest.total_num_virtual_procs = 2
nest.local_num_threads = 1
nest.set_verbosity("M_DEBUG")
nodes_e = nest.Create(
"iaf_psc_alpha", 10
)
local_neurons = [gid.tolist()[0] for gid, status in zip(nodes_e, nest.GetStatus(nodes_e, "local")) if status]
print("Neurons on rank", my_rank_nest, ": ", local_neurons)
# Form a synapse between two neurons both on rank 0
nest.Connect(nest.NodeCollection([4]), nest.NodeCollection([2]), conn_spec="one_to_one", syn_spec={"weight": float(15.), "delay": 1.0})
# Form a synapse between two neurons both on rank 1
# nest.Connect([3], [1], syn_spec={"weight": 15.0, "delay": 1.0})
conns = nest.GetConnections(source=nest.NodeCollection([4]), target=nest.NodeCollection([2]))
print("Result on rank", my_rank_nest, "for 4 -> 2", conns)
#conns = nest.GetConnections(source=nest.NodeCollection([3]), target=nest.NodeCollection([1]))
#print("Result on rank", my_rank_nest, "for 3 -> 1", conns)
nest.Simulate(1.0)
print("Simulation completed")
Run mpirun -n 2 python nest-bug.py will results The output can be found below. When I uncomment he second nest.Connect line the program will run without an exception.
Output with blocking behavior:
-- N E S T --
Copyright (C) 2004 The NEST Initiative
Version: 3.8.0
Built: Apr 28 2025 13:11:24
This program is provided AS IS and comes with
NO WARRANTY. See the file LICENSE for details.
Problems or suggestions?
Visit https://www.nest-simulator.org
Type 'nest.help()' to find out more about NEST.
I am rank 0 out of 2
I am rank 1 out of 2
Neurons on rank 1 : [1, 3, 5, 7, 9]
Neurons on rank 0 : [2, 4, 6, 8, 10]
Result on rank 1 for 4 -> 2 The synapse collection does not contain any connections.
Apr 29 11:05:09 NodeManager::prepare_nodes [Info]:
Preparing 5 nodes for simulation.
Result on rank 0 for 4 -> 2 source target synapse model weight delay
-------- -------- --------------- -------- -------
4 2 static_synapse 15.00 1.000
Apr 29 11:05:09 NodeManager::prepare_nodes [Info]:
Preparing 5 nodes for simulation.
Apr 29 11:05:09 SimulationManager::start_updating_ [Info]:
Number of local nodes: 5
Simulation time (ms): 1
Number of OpenMP threads: 1
Number of MPI processes: 2
Apr 29 11:05:09 SimulationManager::start_updating_ [Info]:
Number of local nodes: 5
Simulation time (ms): 1
Number of OpenMP threads: 1
Number of MPI processes: 2
Blocks forever
Output with the second nest.Connect uncommented:
-- N E S T --
Copyright (C) 2004 The NEST Initiative
Version: 3.8.0
Built: Apr 28 2025 13:11:24
This program is provided AS IS and comes with
NO WARRANTY. See the file LICENSE for details.
Problems or suggestions?
Visit https://www.nest-simulator.org
Type 'nest.help()' to find out more about NEST.
I am rank 0 out of 2
I am rank 1 out of 2
Neurons on rank 1 : [1, 3, 5, 7, 9]
Neurons on rank 0 : [2, 4, 6, 8, 10]
Result on rank 1 for 4 -> 2 The synapse collection does not contain any connections.
Result on rank 0 for 4 -> 2 source target synapse model weight delay
-------- -------- --------------- -------- -------
4 2 static_synapse 15.00 1.000
Result on rank 1 for 3 -> 1 source target synapse model weight delay
-------- -------- --------------- -------- -------
3 1 static_synapse 15.00 1.000
Result on rank 0 for 3 -> 1 The synapse collection does not contain any connections.
Apr 29 11:06:06 NodeManager::prepare_nodes [Info]:
Preparing 5 nodes for simulation.
Apr 29 11:06:06 NodeManager::prepare_nodes [Info]:
Preparing 5 nodes for simulation.
Apr 29 11:06:06 SimulationManager::start_updating_ [Info]:
Number of local nodes: 5
Simulation time (ms): 1
Number of OpenMP threads: 1
Number of MPI processes: 2
Apr 29 11:06:06 SimulationManager::run [Info]:
Simulation finished.
Apr 29 11:06:06 SimulationManager::start_updating_ [Info]:
Number of local nodes: 5
Simulation time (ms): 1
Number of OpenMP threads: 1
Number of MPI processes: 2
Apr 29 11:06:06 SimulationManager::run [Info]:
Simulation finished.
Simulation completed
Simulation completed
Expected behavior
I would expect the program to finish.
Desktop/Environment (please complete the following information):
- OS: Ubuntu 24.04.2
- Shell: zsh
- Python-Version: Python 3.12.3
- NEST-Version: nest-3.8
- Installation: cmake with mpi
CMake output:
cmake -Dwith-mpi=ON -DMPI_CXX_COMPILER=/opt/openmpi/bin/mpicxx -DMPI_C_COMPILER=/opt/openmpi/bin/mpicc -DCMAKE_INSTALL_PREFIX=/home/marvin/dev/nest38_env -DCMAKE_PREFIX_PATH=/opt/openmpi -DMPIEXEC_EXECUTABLE=/opt/openmpi/bin/mpirun -DCMAKE_CXX_COMPILER=mpicxx ../nest-simulator-3.8
-- The CXX compiler identification is GNU 13.3.0
-- The C compiler identification is GNU 13.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/openmpi/bin/mpicxx - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file mach-o/dyld.h
-- Looking for include file mach-o/dyld.h - not found
-- Looking for include file mach/mach.h
-- Looking for include file mach/mach.h - not found
-- Looking for include file memory.h
-- Looking for include file memory.h - found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for C++ include istream
-- Looking for C++ include istream - found
-- Looking for C++ include ostream
-- Looking for C++ include ostream - found
-- Looking for C++ include sstream
-- Looking for C++ include sstream - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long long
-- Check size of long long - done
-- Check size of u_int16_t
-- Check size of u_int16_t - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of u_int64_t
-- Check size of u_int64_t - done
-- Check size of uint64_t
-- Check size of uint64_t - done
-- Looking for NAN
-- Looking for NAN - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for M_E
-- Looking for M_E - found
-- Looking for M_PI
-- Looking for M_PI - found
-- Looking for expm1
-- Looking for expm1 - not found
-- Info: Host triple: x86_64-pc-linux
-- Info: Target triple: x86_64-pc-linux
-- Found Python: /home/marvin/dev/nest38_env/bin/python3 (found suitable version "3.12.3", minimum required is "3.8") found components: Interpreter Development.Module
-- Found Cython: /home/marvin/.local/bin/cython (found suitable version "3.0.8", minimum required is "0.28.3")
-- Found LTDL: /usr/lib/x86_64-linux-gnu/libltdl.so (found version "2.4.7")
-- Found Readline: /usr/lib/x86_64-linux-gnu/libreadline.so (found version "8.2")
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1")
-- Found GSL: /usr/include (found version "2.7.1")
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found MPI_C: /opt/openmpi/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /opt/openmpi/bin/mpicxx (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Could NOT find PY_mpi4py (missing: PY_MPI4PY)
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.69.0")
-- Info: Check the abort exitcode.
-- Info: Check the abort exitcode. 134
-- Info: Check the segmentation fault exitcode.
-- Info: Check the segmentation fault exitcode. 139
-- Info: Check whether the compiler ignores cmath makros.
-- Info: Check whether the compiler ignores cmath makros. OFF
-- Info: Check whether the compiler does NOT include <*.h> headers ISO conformant.
-- Info: Check whether the compiler does NOT include <*.h> headers ISO conformant. OFF
-- Info: Check whether the compiler respects symbolic signal names in signal.h.
-- Info: Check whether the compiler respects symbolic signal names in signal.h. OFF
-- Info: Check static template member declaration.
-- Info: Check static template member declaration. OFF
-- Info: Check for STL vector capacity base unity.
-- Info: Check for STL vector capacity base unity. ON
-- Info: Check for STL vector capacity doubling strategy.
-- Info: Check for STL vector capacity doubling strategy. ON
-- Info: Check whether the compiler fails with ICE.
-- Info: Check whether the compiler fails with ICE. OFF
-- Info: Check if ::nan is available from cmath.
-- Info: Check if ::nan is available from cmath. ON
-- Info: Check if ::isnan is available from cmath.
-- Info: Check if ::isnan is available from cmath. ON
-- Info: Check if Random123 generators work.
-- Info: Check if Random123 generators work. ON
-- Info: Done configuring NEST version: 3.8.0
--------------------------------------------------------------------------------
NEST Configuration Summary
--------------------------------------------------------------------------------
Target System : Linux
Cross Compiling : FALSE
C compiler : GNU 13.3.0 (/usr/bin/cc)
C compiler flags : -Wall -fopenmp -O2 -fdiagnostics-color=auto
C++ compiler : GNU 13.3.0 (/opt/openmpi/bin/mpicxx)
C++ compiler flags : -std=c++17 -Wall -fopenmp -O2 -fdiagnostics-color=auto
Build dynamic : ON
Built-in modelset : full
Python bindings : Yes (Python 3.12.3: /home/marvin/dev/nest38_env/bin/python3)
Includes : /usr/include/python3.12
Libraries :
Cython : Yes (Cython 3.0.8: /home/marvin/.local/bin/cython)
MPI4Py : No
Documentation : No
Use threading : Yes (OpenMP: -fopenmp)
Libraries : /usr/lib/gcc/x86_64-linux-gnu/13/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.a
Use GSL : Yes (GSL 2.7.1)
Includes : /usr/include
Libraries : /usr/lib/x86_64-linux-gnu/libgsl.so;/usr/lib/x86_64-linux-gnu/libgslcblas.so
Use Readline : Yes (GNU Readline 8.2)
Includes : /usr/include
Libraries : /usr/lib/x86_64-linux-gnu/libreadline.so;/usr/lib/x86_64-linux-gnu/libncurses.so
Use libltdl : Yes (LTDL 2.4.7)
Includes : /usr/include
Libraries : /usr/lib/x86_64-linux-gnu/libltdl.so
Use MPI : Yes (MPI: /opt/openmpi/bin/mpicxx)
Includes :
Libraries :
Launcher : /opt/openmpi/bin/mpirun -n <np> <prog> <args>
Detailed timers : No
Use MUSIC : No
Use libneurosim : No
Use Boost : Yes (Boost 1.83.0)
Includes : /usr/include
Libraries :
Use SIONlib : No
Use HDF5 : No
For details on setting specific flags for your MPI launcher command, see the
CMake documentation at https://cmake.org/cmake/help/latest/module/FindMPI.html
--------------------------------------------------------------------------------
The NEST executable will be installed to:
/home/marvin/dev/nest38_env/bin/
NEST dynamic libraries and user modules will be installed to:
/home/marvin/dev/nest38_env/lib/nest/
PyNEST will be installed to:
/home/marvin/dev/nest38_env/lib/python3.12/site-packages
To set necessary environment variables, add the following line
to your ~/.bashrc :
source /home/marvin/dev/nest38_env/bin/nest_vars.sh
--------------------------------------------------------------------------------
You can now build and install NEST with
make
make install
make installcheck
If you experience problems with the installation or the use of NEST,
please see https://www.nest-simulator.org/frequently_asked_questions
or go to https://www.nest-simulator.org/community to find out how to
join the user mailing list.
-- Configuring done (15.4s)
-- Generating done (0.1s)
-- Build files have been written to: /home/marvin/dev/nest38-build2
Metadata
Metadata
Assignees
Labels
I: No breaking changePreviously written code will work as before, no one should note anything changing (aside the fix)Previously written code will work as before, no one should note anything changing (aside the fix)S: HighShould be handled nextShould be handled nextT: BugWrong statements in the code or documentationWrong statements in the code or documentation
Type
Projects
Status
To do (open issues)