Dear Xavier,

This is not really a bug, but rather a missing feature. Using GetLocalNodeCollection is actually the best option here at present. One point where you can do a bit better is setting the constant 0.25 on all nodes, which you can do by

nodes.b = 0.25

At present, this only works for setting the same value on all nodes. Correspondingly, you can print values from all nodes as

print(nest.Rank(), nodes.U_m)

For non-local nodes, the resulting tuple will contain None.

We still need to work on support for expressions such as

     nodes.b = np.linspace(0.1, 0.5, len(nodes))
     nodes.U_m = nodes.b * nodes.V_m

that would handle parallelization entirely behind the scenes. A key problem here is that linspace() might create a very large array of mostly unused elements if we are working highly parallel. On the other hand, a scheme in which the user would need to manually craft the linspace parameters for each Rank to contain only values for local nodes would be high-risk code—easy to get details wrong.

We have this on our radar, but I am not sure when we will get to it.

Best,
Hans Ekkehard

-- 

Prof. Dr. Hans Ekkehard Plesser
Research Committee Chair, Faculty of Science and Technology
Department of Data Science
Faculty of Science and Technology
Norwegian University of Life Sciences
PO Box 5003, 1432 Ås, Norway
Phone +47 6723 1560
Email hans.ekkehard.plesser@nmbu.no
Home http://arken.nmbu.no/~plesser



From: Xavier Otazu <xotazu@cvc.uab.cat>
Date: Friday, 20 November 2026 at 19:33
To: users@nest-simulator.org <users@nest-simulator.org>
Subject: [NEST Users] Strange bug about read/write variable and MPI

Hi!

I have (finally) installed NEST 3.10 ... and I have step on a problem.

The code below has two options to assign neurons to nodes:
   - If use the direct assignment ( nodes = neurons ), it works correctly on sequential execution, but it fails when executing using mpirun.
   - If use the GetLocalNodeCollection() assignment ( I know it is deprecated ), it works CORRECTLY on BOTH sequential and mpirun execution.

This is the message I get, related to not knowing about b, but it does not complain about the writing use in 'node.b=0.25'. That is, it looks like there is a problem when combining MPI and reading that node.b variable.


Traceback (most recent call last):
  File "/home/xotazu/neuro/nest_2/test_3_10_inzhikevich.py", line 11, in <module>
    node.U_m = node.b * node.V_m
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_types.py", line 610, in __getattr__
Traceback (most recent call last):
  File "/home/xotazu/neuro/nest_2/test_3_10_inzhikevich.py", line 11, in <module>
    node.U_m = node.b * node.V_m
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_types.py", line 610, in __getattr__
    return self.get(attr)
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_types.py", line 413, in get
    result = get_parameters(self, params[0])
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_helper.py", line 459, in get_parameters
    return self.get(attr)
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_types.py", line 413, in get
    result = nestkernel.llapi_get_nc_status(nc._datum, param)
    result = get_parameters(self, params[0])
  File "/home/neurobit/local/nest_3.10/lib64/python3.9/site-packages/nest/lib/hl_api_helper.py", line 459, in get_parameters
  File "nestkernel_api.pyx", line 603, in nestkernel_api.llapi_get_nc_status
KeyError: 'b'
    result = nestkernel.llapi_get_nc_status(nc._datum, param)
  File "nestkernel_api.pyx", line 603, in nestkernel_api.llapi_get_nc_status
KeyError: 'b'


Xavier

---------------------------
import nest


pos = nest.spatial.grid(shape=[124,124])


neurons = nest.Create("izhikevich",positions=pos)

#nodes = neurons
nodes = nest.GetLocalNodeCollection(neurons)


for node in nodes:
        node.b=0.25;
        node.U_m = node.b * node.V_m
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org