Hi Hans,

When you fixed that bug, tell me and I could take a look at a new possible solution (after you tell me what this better solution can be 🙂 ).

I tried not to use the second line, but an error occurred on GetConnections() telling me to use a NodeCollection as input parameter instead of a list. In fact, I see an example using GetLocalNodeCollection and the second line in the following python example code:https://nest-simulator.readthedocs.io/en/v3.3/auto_examples/hpc_benchmark.html?highlight=GetLocalNodeCollection

Anyway, in the next few days I am going to try again my code without that second line.

Thanks!

Xavier



From: Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no>
Sent: Tuesday, April 9, 2024 2:40 PM
To: NEST User Mailing List <users@nest-simulator.org>
Subject: [NEST Users] Re: Enhancement of C++ implementation of DumpLayerConnections()
 

 

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

Home http://arken.nmbu.no/~plesser

 

 

 

From: Xavier Otazu <xotazu@cvc.uab.cat>
Date: Monday, 8 April 2024 at 16:43
To: users@nest-simulator.org <users@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@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org


Computer Vision Center
CONFIDENTIALITY WARNING