Dear Xavier,
Thank you for your detailed email—do not worry about writing technical here! Overall your
thoughts are sound, but even better solutions should be feasible once I have fixed
https://github.com/nest/nest-simulator/pull/3132.
BTW, you should not need the second line in
local_nodes = nest.GetLocalNodeCollection(target_layer)
local_nodes = nest.NodeCollection(local_nodes)
since GetLocalNodeCollection should return a NodeCollection object.
Best,
Hans Ekkehard
--
Prof. Dr. Hans Ekkehard Plesser
Department of Data Science
Faculty of Science and Technology
Norwegian University of Life Sciences
PO Box 5003, 1432 Aas, Norway
Phone +47 6723 1560
Email hans.ekkehard.plesser@nmbu.no<mailto:hans.ekkehard.plesser@nmbu.no>
Home
http://arken.nmbu.no/~plesser
From: Xavier Otazu <xotazu(a)cvc.uab.cat>
Date: Monday, 8 April 2024 at 16:43
To: users(a)nest-simulator.org <users(a)nest-simulator.org>
Subject: [NEST Users] Enhancement of C++ implementation of DumpLayerConnections()
Hi!
After using some PyNEST functions and modifying the C++ implementation of
DumpLayerConnections(), I was thinking on a possible further improvement of this function
(or creating a new function). But since I do not know the design and architecture of C++
nestkernel code, I prefer to ask.
In my code I normalize the presynaptic connections of every neuron. To do this, I
originally do something like
for i in range(len(target_layer))
conn[i] = nest.GetConnections(source_layer, target_layer, synapse_model)
normalize(conn)
Since I am using MPI and the loop iterates over all the neurons, I modified the previous
code to
local_nodes = nest.GetLocalNodeCollection(target_layer)
local_nodes = nest.NodeCollection(local_nodes)
for i in range(len(local_nodes))
conn[i] = nest.GetConnections(source_layer, local_nodes, synapse_model)
normalize(conn)
This last code is faster that the previous one (I guess that local_nodes variable is local
to every MPI process and, as a consequence, GetConnections() is more efficient because it
only works with local nodes instead of with all of them).
Using the idea of the GetLocalNodeCollection(), I was thinking it could be used into the
C++ implementation of DumpLayerConnections(). Presently, this function obtain all the
connections between source and target layers. Could it be possible to call the equivalent
C++ implementation of GetLocalCollection()? I understand that the problem is that, since
DumpLayerConnections() needs the spatial information of the layers, the node collections
obtained with GetLocalNodeCollection() (I guess similarly its C++ implementation) does not
have this spatial information.
As a second possibility, I was thinking on adding a new method (GetSpatialInformation())
and enhancing DumpLayerConnections() (or add a new function). The GetSpatialInformation()
function could return the spatial information of a collection of nodes (the ones obtained
by GetLocalNodeCollection() ). The DumpLayerConnections() (or a new function) could be
enhanced by changing the target layer parameter to a pair of parameters that contain the
local nodes collection and their spatial information. Something like
DumpLaterConnections(source_layer, local_nodes_collection, spatial_information,
synapse_model). This way DumpLayerConnections() will only used local nodes and would be
much faster.
Sorry for the technical email.
Xavier
_______________________________________________
NEST Users mailing list -- users(a)nest-simulator.org
To unsubscribe send an email to users-leave(a)nest-simulator.org