suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
144 stars 135 forks source link

Model with subConnParams not replicable on diff num cores #456

Open salvadord opened 4 years ago

salvadord commented 4 years ago
salvadord commented 4 years ago

tried without groupSunMechs but still different results

salvadord commented 4 years ago

tried 'density': 'uniform' and still got different results

salvadord commented 4 years ago

Fixed by sorting conns before distributing them. Testing on GCP now

salvadord commented 4 years ago

tested M1 model with 64 vs 128 cores and identical

salvadord commented 4 years ago
salvadord commented 4 years ago
salvadord commented 4 years ago

Tried without groupedSyns and still got different (v54_batch16 vs 17) (though smaller difference)

salvadord commented 4 years ago

tried 'uniform' distribution for all rules, but still differen (128 vs 256 cores)

salvadord commented 4 years ago

can't be loc precision because not using groupedSyns!

salvadord commented 4 years ago

add v['loc'] to sort

salvadord commented 4 years ago

test subconn ordering of conns before uniform distribution

salvadord commented 4 years ago

comparing saved output json files (conns and spikes) showed no difference in conns (even though spikes times different)! properly compared? maybe not because nested? becasue ignored order? try comparing h.netcon info? would only show for cells in node 0

salvadord commented 4 years ago
salvadord commented 4 years ago
salvadord commented 4 years ago

h.netcon is done per node, so doesn't have info of presyn gid if presyn cell in different node.
ah! actually can use netcon.srcgid() !

compared across all nodes by saving to json and merging files... identical h.list('netcon') info!!

salvadord commented 4 years ago

Comparing output of psection now across all nodes.

Other things to try:

salvadord commented 4 years ago

Summary:

salvadord commented 4 years ago
salvadord commented 4 years ago

Reduced to minimal model with 1 cell with 5 compartments and 100 netstims spiking at 15hz, all connected to the cell (no subconn rules; fixed delay of 5 ms). If netstims target soma: sims identical on 3 vs 4 cores if netstims target Adend1: voltage differs up to 0.1 mV after 1 sec on 3 vs 4 cores

salvadord commented 4 years ago

Next steps:

salvadord commented 4 years ago

manage to show reproducibility issue in a very simple model: a single 5-compartment cell with 100 NetStims as input; if run for 1 sec on 3 vs 4 cores get different voltages (up to 3mV difference!)

requires very specific tuning: e.g. syns have to be on ‘Adend1’ sec and temperature has to be 34ºC however, still not really sure where the discrepancy is coming from…

from netpyne import specs, sim
# Network parameters
netParams = specs.NetParams()  # object of class NetParams to store the network parameters
## Population parameters
netParams.popParams['IT5B'] = {'cellType': 'IT', 'numCells': 1, 'cellModel': 'HH'}
netParams.popParams['input'] = { 'numCells': 100, 'rate': 15, 'noise': 1.0, 'start':0, 'cellModel': 'NetStim'}
## Cell property rules
netParams.loadCellParamsRule(label='IT5B_reduced', fileName='IT5B_reduced_cellParams.pkl')
netParams.cellParams['IT5B_reduced']['conds'] = {'cellType': 'IT'}
## Synaptic mechanism parameters
netParams.synMechParams['AMPA'] = {'mod': 'Exp2Syn', 'tau1': 0.05, 'tau2': 5.3, 'e': 0}  # excitatory synaptic mechanism
## Cell connectivity rules
netParams.connParams['input->IT5B'] = {  #  S -> M label
    'preConds': {'pop': 'input'},   # conditions of presyn cells
    'postConds': {'pop': 'IT5B'}, # conditions of postsyn cells
    'probability': 1.0,             # probability of connection
    'weight': 0.5,              # synaptic weight
    'delay': 5,                     # transmission delay (ms)
    'synMech': ['AMPA'],
    'oneSynPerNetcon': True,
    'sec': ['Adend1']}              # synaptic mechanism
# Simulation options
simConfig = specs.SimConfig()       # object of class SimConfig to store simulation configuration
simConfig.duration = 1*1e3          # Duration of the simulation, in ms
simConfig.dt = 0.05         # Internal integration timestep to use
simConfig.verbose = False  # Show detailed messages
simConfig.seeds = {'conn': 4321, 'stim': 1234, 'loc': 4321}
simConfig.hParams = {'celsius': 34, 'v_init': -80}
simConfig.recordTraces = {'V_soma':{'sec':'soma','loc':0.5,'var':'v'}}  # Dict with traces to record
simConfig.recordStep = 0.1          # Step size in ms to save data (eg. V traces, LFP, etc)
simConfig.saveJson = True   
simConfig.filename = 'model3'  # Set file output name

simConfig.analysis['plotRaster'] = True             # Plot a raster
simConfig.analysis['plotTraces'] = {'include': [0]}             # Plot recorded traces for this list of cells
# Create network and run simulation
sim.createSimulateAnalyze(netParams = netParams, simConfig = simConfig)
salvadord commented 4 years ago

testing if dt = 0.025 and recordStep = 0.025 fixes issue in orig model