Dear Jan,

Thank you very much for exhaustive answer.

We are using single mpi process (python3 sctipt.py) with given number of virtual processes. However, GetConnections returns different source neurons as well, e.g.:

Before Simulate: source = [21, 21, 22, 23, 24,....]
After Simulate: source=[23, 24, 24, 27,....]

We've noticed that sources are ordered while targets are not but still there is some missmatch before and after simulation.

I have to point out that our network is designed as 3D structure with stdp synapses generated based on the distance between each pair of neurons and with given probability as follows:

conn_dict = {
        'rule': 'pairwise_bernoulli',
        'p': nest.spatial_distributions.exponential(nest.spatial.distance, beta = 50),
        'mask': {'spherical': {'radius': 60}},
        'allow_autapses': True,
        'allow_multapses': False
    }

We aim to obtain exact weights of the stdp synapses after presenting some input to the network and then to fix the weights so we appreciate your help very much.

Best wishes,
Petia

On Tuesday, June 6, 2023 at 12:14:30 PM GMT+3, Vogelsang, Jan <j.vogelsang@fz-juelich.de> wrote:


Dear Petia,


Are you invoking your simulation script using MPI (e.g. mpiexec python script.py) or are you just using a single process (e.g. python script.py)? In the latter case, increasing the number of virtual processes (using nest.total_num_virtual_procs) simply increases the number of threads used by that single process which is internally used for OpenMP shared-memory parallelization which therefore runs NEST in a non-distributed way.


When using a single process, GetConnections (if called without any parameters) returns all connections in the whole simulation. Calling GetConnections before and after the first call to Simulate (or Prepare) is indeed expected to return the connections in a different order. To massively increase the performance of the simulation, all connections are sorted by their corresponding source node prior to the first update cycle in the simulation.


If you want to collect weights for connections in the same order before and after the simulation, please run "nest.Prepare()" once before your first call to Simulate. While this call is redundant (as it will be called inside Simulate as well), it will ensure that all connections are already sorted. After your call to Prepare, you can call GetConnections to retrieve information about all connections in the correct order.


Please note that it is not yet possible to get precise STDP weights yet due to some internal optimizations, while the weight for most synapses will be correct and precise, it is not guaranteed to be the case for each individual synapse. If you need to get exact weights for individual synapses, please let me know, as I am currently actively working on that. If you are just interested in stochastic analysis of weights, you can safely assume that weights are sufficiently accurate across a whole population.


Best,
Jan


From: Petia Koprinkova <pkoprinkova@yahoo.com>
Sent: Tuesday, June 6, 2023 10:38:38 AM
To: NEST User Mailing List
Subject: [NEST Users] Re: GetConnections in distributed simulation
 
Dear Hans Ekkehard,

We are not using mpi4py. We simply set the number of virtual processes at the begining of simulation:
nest.total_num_virtual_procs = 32 for example

We want to collect weights of stdp synapses before and after the simulation. Getting connections however, we observed different source and target before and after we run the simulation. I suppose this is because GetConnections returns only a portion of connections but how to obtain all portions is not clear for us.

Best,
Petia


On Tuesday, June 6, 2023 at 09:24:30 AM GMT+3, Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no> wrote:


 

Dear Petia,

 

On each MPI rank, GetConnections() will only collect connections for which the post-synaptic neuron is on that MPI rank. You then need to find a way to collect this information across ranks. If you only need that information for offline processing, it might be easiest to write the connection information to file from each rank and then collect across ranks (you probably don't want to store the result from GetConnections(), but rather get the status of the synapses and store that). As a starting point, you could take the

 

https://nest-simulator.readthedocs.io/en/v3.4/auto_examples/store_restore_network.html

 

example. There, connections (and neurons) are stored with

 

   network = {}

    network["n_vp"] = nest.total_num_virtual_procs

    network["e_nrns"] = self.neurons.get(["V_m"], output="pandas")

    network["i_nrns"] = self.neurons.get(["V_m"], output="pandas")

 

    network["e_syns"] = nest.GetConnections(synapse_model="e_syn").get(

        ("source", "target", "weight"), output="pandas")

    network["i_syns"] = nest.GetConnections(synapse_model="i_syn").get(

        ("source", "target", "weight"), output="pandas")

 

    with open(dump_filename, "wb") as f:

        pickle.dump(network, f, pickle.HIGHEST_PROTOCOL)

 

You might not need the data on neurons, and you would have to write one file per MPI rank. Depending on your synapse type, you may want to store more parameters than source, target and weight.

 

If you need the information at runtime, you could try to use mpi4py to aggregate the connection information across ranks.

 

Best,

Hans Ekkehard

 

-- 

 

Prof. Dr. Hans Ekkehard Plesser

Head, 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: Petia Koprinkova <pkoprinkova@yahoo.com>
Date: Monday, 5 June 2023 at 13:11
To: NEST User Mailing List <users@nest-simulator.org>
Subject: [NEST Users] GetConnections in distributed simulation

Dear NEST Support team,

We are trying to get the weights of stdp synapses during a distributed simulation.

According to NEST documentation and our experience function GetConnections returns only local connections but not all connections in our model.

Could you please advise us how to get all connections in such a case?

Best regards,

Petia Koprinkova-Hristova

_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Stefan Müller
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Dr. Ir. Pieter Jansens,
Prof. Dr. Astrid Lambrecht, Prof. Dr. Frauke Melchior
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org