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