nest / nest-simulator

The NEST simulator
http://www.nest-simulator.org
GNU General Public License v2.0
544 stars 369 forks source link

`nest.Connect` accepts one-to-one node ID lists under MPI, despite note in docs #2644

Open Helveg opened 1 year ago

Helveg commented 1 year ago

Describe the flaw The PyNEST API reference for nest.Connect states:

Notes

It is possible to connect NumPy arrays of node IDs one-to-one by passing the arrays as pre and post, specifying ‘one_to_one’ for conn_spec. In that case, the arrays may contain non-unique IDs. You may also specify weight, delay, and receptor type for each connection as NumPy arrays in the syn_spec dictionary. This feature is currently not available when MPI is used; trying to connect arrays with more than one MPI process will raise an error.

But my reproducer shows that I can one-to-one connect 2 numpy arrays of node IDs under MPI.

Supporting materials The following reproducer shows that NEST happily takes node lists under MPI:

import nest
import numpy as np
from mpi4py.MPI import COMM_WORLD

a = nest.Create("iaf_cond_alpha", 100)
b = nest.Create("iaf_cond_alpha", 100)

rands = COMM_WORLD.bcast(np.random.randint(0, 100, size=(2000, 2)))
nest.Connect(
    rands[:, 0] + 1,
    rands[:, 1] + 101,
    "one_to_one",
    {"synapse_model": "static_synapse", "weight": [1] * 2000, "delay": [1] * 2000},
)
nest.Simulate(1000)
(bsb) robin@TNG2019:/mnt/d/DATA/test-bsb$ mpirun -n 4 python test_mpi_one_to_one.py

              -- N E S T --
  Copyright (C) 2004 The NEST Initiative

 Version: master@55ee309cf3
 Built: Mar 15 2023 14:24:26

 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.

              -- N E S T --
  Copyright (C) 2004 The NEST Initiative

 Version: master@55ee309cf3
 Built: Mar 15 2023 14:24:26

 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.

              -- N E S T --
  Copyright (C) 2004 The NEST Initiative

 Version: master@55ee309cf3
 Built: Mar 15 2023 14:24:26

 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.

              -- N E S T --
  Copyright (C) 2004 The NEST Initiative

 Version: master@55ee309cf3
 Built: Mar 15 2023 14:24:26

 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.

Mar 15 14:52:16 NodeManager::prepare_nodes [Info]:
    Preparing 50 nodes for simulation.

Mar 15 14:52:16 NodeManager::prepare_nodes [Info]:
    Preparing 50 nodes for simulation.

Mar 15 14:52:16 NodeManager::prepare_nodes [Info]:
    Preparing 50 nodes for simulation.

Mar 15 14:52:16 NodeManager::prepare_nodes [Info]:
    Preparing 50 nodes for simulation.

Mar 15 14:52:16 SimulationManager::start_updating_ [Info]:
    Number of local nodes: 50
    Simulation time (ms): 1000
    Number of OpenMP threads: 1
    Number of MPI processes: 4

Mar 15 14:52:16 SimulationManager::start_updating_ [Info]:
    Number of local nodes: 50
    Simulation time (ms): 1000
    Number of OpenMP threads: 1
    Number of MPI processes: 4

Mar 15 14:52:16 SimulationManager::start_updating_ [Info]:
    Number of local nodes: 50
    Simulation time (ms): 1000
    Number of OpenMP threads: 1
    Number of MPI processes: 4

Mar 15 14:52:16 SimulationManager::start_updating_ [Info]:
    Number of local nodes: 50
    Simulation time (ms): 1000
    Number of OpenMP threads: 1
    Number of MPI processes: 4

Mar 15 14:52:16 SimulationManager::run [Info]:
    Simulation finished.

Mar 15 14:52:16 SimulationManager::run [Info]:
    Simulation finished.

Mar 15 14:52:16 SimulationManager::run [Info]:
    Simulation finished.

Mar 15 14:52:16 SimulationManager::run [Info]:
    Simulation finished.

Desktop/Environment NEST built from recent master 55ee309cf31d9ac6b63261311276254716cdc595

github-actions[bot] commented 1 year ago

Issue automatically marked stale!

github-actions[bot] commented 9 months ago

Issue automatically marked stale!