CoreNeuron icon indicating copy to clipboard operation
CoreNeuron copied to clipboard

Different spike times when running simple NetPyNE model (tut2.py) with coreneuron

Open salvadord opened this issue 4 years ago • 15 comments

The spike times of the tut2.py example are different when using coreneuron. This example is a simple 40-neuron network with single-compartment neurons, hh mechanism, Exp2Syn synapses and NetStims.

To reproduce:

  • clone the "coreneuron" branch of netpyne: https://github.com/Neurosim-lab/netpyne/tree/coreneuron

  • go to the netpyne/examples/coreneuron folder: https://github.com/Neurosim-lab/netpyne/tree/coreneuron/examples/coreneuron

  • run tut2.py (to generate the original example spikes)

  • run tu2t_coreneuron.py (to generate the coreneuron version spikes)

  • run compare.py (to compare spike times)

salvadord avatar Nov 14 '19 18:11 salvadord

Hello @salvadord ,

Just an update on the progress on this ticket. I started investigating this issue a few days ago but I didn't have time to find a solution. My conclusion until now is that coreneuron and netpyne/neuron create different events from netstim and this is why the spike output of the simulation with using neuron and coreneuron are different. I will need to investigate this further after the Christmas holidays. I also created a fork of netpyne and pushed there some changes needed to make coreneuron work with netpyne in my system.

Kind Regards and Happy Holidays, Ioannis

iomaganaris avatar Dec 19 '19 17:12 iomaganaris

Hi @iomaganaris, thanks for looking into this. I can check if the netstim spike times are different, and if so, I can replace it with a vecstim with fixed spike times.

Thanks and happy holidays!

salvadord avatar Dec 19 '19 18:12 salvadord

If NetStim spike times are different, I'd first check the state of the Random123 generators after INITIAL for NEURON and CoreNEURON

nrnhines avatar Dec 19 '19 19:12 nrnhines

I followed the instructions at the beginning of this issue with netpyne hnn_12Aug19-38-g69f1273e nrn 7.8.0-52-gb819d6ea coreneuron 0.12-70-ga78233a

python3.6 tut2_coreneuron.py gave me the error ( I also added some debug printf so the netpar.cpp line number is different)

Running simulation using CoreNEURON for 1000.0 ms...
inode=8767463 end=120
output_index_ = 12
thvar_=0x42e3f38 _actual_v=(nil)
use_cachevec=1 tree_changed=1
python3.6: /home/hines/neuron/nrncmake/src/nrniv/netpar.cpp:1589: void nrncore_netpar_cellgroups_helper(nrncore_CellGroup*): Assertion `inode <= ps->nt_->end' failed.
Aborted (core dumped)

So in my case the earlier problem is that the model is not initialized prior to transfer. (I have not gotten to the point of investigating any potential differences between tut2.py and tut2_coreneuron.py). I realized I failed to perform the same prerequisite checks for nrncore_run as for nrncore_write and now, after some small changes, when I do so, I get

Recording 1 traces of 1 types on node 0

Running simulation using CoreNEURON for 1000.0 ms...
NEURON: NEURON model for CoreNEURON must already be initialized (cf finitialize(...))
 near line 0
 tstop=1000.0
             ^
        ParallelContext[1].nrncore_run("-e 1000", 0)

Since initialization is potentially a highly model specific activity, I'm inquiring what it should be in this case. Also, it is not clear to me why I got this issue and no one else experienced the assertion error.

nrnhines avatar Dec 24 '19 18:12 nrnhines

@nrnhines why does the netpyne versions say "hnn_12Aug19-38"? The commit number is correct (g69f1273e), but not sure where the preceding part is coming from...

salvadord avatar Dec 24 '19 18:12 salvadord

Hello @nrnhines,

I remember that I got the same assertion error in the beginning and if I remember correctly the issue is that cvode.cache_efficient(1) is called right before the nrncore_run and not in the beginning of the setup of the simulation. You can try with my branch and check if there is still some issue.

Merry Christmas everyone!

iomaganaris avatar Dec 24 '19 19:12 iomaganaris

hi @iomaganaris, yes we figured out that was the issue, and I just pushed a change to the netpyne 'coreneuron' branch to run cahce_efficient(1) before. Thanks and merry christmas!

salvadord avatar Dec 24 '19 19:12 salvadord

I'm trying to install coreneuron on google cloud VM with Centos 7, following the same steps as during the hackathon, but I'm getting the following error (@iomaganaris any suggestions?):

[ext_salvadordura_gmail_com@coreneuron nrn]$ mkdir build
[ext_salvadordura_gmail_com@coreneuron nrn]$ cd build
[ext_salvadordura_gmail_com@coreneuron build]$ cmake .. -DPYTHON_EXECUTABLE=/usr/bin/python3 -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_RX3D=ON -DNRN_ENABLE_CORENEURON=ON
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
^C
[ext_salvadordura_gmail_com@coreneuron build]$ sudo cmake .. -DPYTHON_EXECUTABLE=/usr/bin/python3 -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_RX3D=ON -DNRN_ENABLE_CORENEURON=ON
sudo: cmake: command not found
[ext_salvadordura_gmail_com@coreneuron build]$ cmake .. -DPYTHON_EXECUTABLE=/usr/bin/python3 -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_RX3D=ON -DNRN_ENABLE_CORENEURON=ON
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'RelWithDebInfo' as none was specified.
-- Found BISON: /usr/bin/bison (found version "3.0.4") 
-- Found FLEX: /usr/bin/flex (found version "2.5.37") 
-- Could NOT find Readline (missing: Readline_INCLUDE_DIR Readline_LIBRARY) 
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.8") 
-- Found Cython: /usr/bin/cython3 (found version "0.28.5") 
-- Found MPI_C: /usr/lib64/openmpi/lib/libmpi.so (found version "3.0") 
-- Found MPI_CXX: /usr/lib64/openmpi/lib/libmpi_cxx.so (found version "3.0") 
-- Found MPI: TRUE (found version "3.0")  
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.8", minimum required is "3") 
-- Found PythonLibs: /usr/lib64/libpython3.6m.so
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Building CoreNEURON from submodule
-- Sub-project : using coreneuron from from external/coreneuron
-- Found MOD2C: /home/ext_salvadordura_gmail_com/nrn/external/coreneuron/external/mod2c  
-- Using mod2c submodule from /home/ext_salvadordura_gmail_com/nrn/external/coreneuron/external/mod2c
-- CXX Compile flags from BUILD_TYPE (RELWITHDEBINFO): -g  -O2
-- 
-- Configured CoreNEURON 
-- 
-- Some things you can do now:
-- --------------------+--------------------------------------------------------
-- Command             |   Description
-- --------------------+--------------------------------------------------------
-- make install        | Will install CoreNEURON to: /usr/local
-- --------------------+--------------------------------------------------------
--  Build option       | Status
-- --------------------+--------------------------------------------------------
-- MPI                 | ON
--   INC               | /usr/include/openmpi-x86_64
-- OpenMP              | ON
-- NMODL               | OFF
-- MOD2C               | /home/ext_salvadordura_gmail_com/nrn/external/coreneuron/external/mod2c
-- GPU Support         | OFF
-- CUDA Unified Memory | OFF
-- Auto Timeout        | ON
-- Wrap exp()          | OFF
-- SplayTree Queue     | ON
-- NetReceive Buffer   | ON
-- Caliper             | OFF
-- Likwid              | OFF
-- Unit Tests          | OFF
-- ReportingLib        | OFF
--   SONATA support    | OFF
-- --------------+--------------------------------------------------------------
--  See documentation : https://github.com/BlueBrain/CoreNeuron/
-- --------------+--------------------------------------------------------------
-- 
-- 
-- Configured NEURON 7.8
-- 
-- Some things you can do now:
-- --------------+--------------------------------------------------------------
-- Command       |   Description
-- --------------+--------------------------------------------------------------
-- make install  | Will install NEURON to: /usr/local
--               | Change the install location of NEURON using:
--               |     cmake <src_path> -DCMAKE_INSTALL_PREFIX=<install_path>
-- make docs     | Build the API documentation
-- make uninstall| Removes files installed by make install (todo)
-- --------------+--------------------------------------------------------------
--  Build option | Status
-- --------------+--------------------------------------------------------------
-- BUILD_TYPE    | RelWithDebInfo (allowed: Custom;Debug;Release;RelWithDebInfo;Fast)
-- COMPILE FLAGS | -g  -O2
-- Shared        | ON
-- Legacy FR     | ON
-- MPI           | ON
--   INC         | /usr/include/openmpi-x86_64
--   LIB         | /usr/lib64/openmpi/lib/libmpi_cxx.so
-- Python        | ON
--   EXE         | /usr/bin/python3
--   INC         | /usr/include/python3.6m
--   LIB         | /usr/lib64/libpython3.6m.so
--   DYNAMIC     | OFF
-- RX3D          | ON
--   OptLevel    | 0
-- Interviews    | OFF
-- CoreNEURON    | ON
--   PATH        | /home/ext_salvadordura_gmail_com/nrn/external/coreneuron
-- --------------+--------------------------------------------------------------
--  See documentation : https://www.neuron.yale.edu/neuron/
-- --------------+--------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ext_salvadordura_gmail_com/nrn/build
[ext_salvadordura_gmail_com@coreneuron build]$ make install 
Scanning dependencies of target mod2c
[  0%] Creating directories for 'mod2c'
[  0%] No download step for 'mod2c'
[  0%] No patch step for 'mod2c'
[  0%] No update step for 'mod2c'
[  1%] Performing configure step for 'mod2c'
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- mod2c is used as APPLICATION_NAME
-- Found BISON: /usr/bin/bison (found version "3.0.4") 
-- Found FLEX: /usr/bin/flex (found version "2.5.37") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ext_salvadordura_gmail_com/nrn/build/external/coreneuron/mod2c-prefix/src/mod2c-build
[  1%] Performing build step for 'mod2c'
[  4%] [FLEX][lex] Building scanner with flex 2.5.37
[  8%] [BISON][diffeq] Building parser with bison 3.0.4
diffeq.y: warning: 5 shift/reduce conflicts [-Wconflicts-sr]
[ 12%] [BISON][parse1] Building parser with bison 3.0.4
Scanning dependencies of target mod2c_core
[ 16%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/consist.c.o
[ 20%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/io.c.o
[ 24%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/list.c.o
[ 28%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/nocpout.c.o
[ 32%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/partial.c.o
[ 36%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/solve.c.o
[ 40%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/version.c.o
[ 44%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/discrete.c.o
[ 48%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/kinetic.c.o
[ 52%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/modl.c.o
[ 56%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/parsact.c.o
[ 60%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/sens.c.o
[ 64%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/symbol.c.o
[ 68%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/deriv.c.o
[ 72%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/init.c.o
[ 76%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/noccout.c.o
[ 80%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/simultan.c.o
[ 84%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/units.c.o
[ 88%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/diffeq.c.o
[ 92%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/parse1.c.o
[ 96%] Building C object src/mod2c_core/CMakeFiles/mod2c_core.dir/lex.c.o
[100%] Linking C executable mod2c_core
[100%] Built target mod2c_core
[  1%] Performing install step for 'mod2c'
[100%] Built target mod2c_core
Install the project...
-- Install configuration: "Release"
-- Installing: /home/ext_salvadordura_gmail_com/nrn/build/share/nrnunits.lib
-- Installing: /home/ext_salvadordura_gmail_com/nrn/build/bin/mod2c_core
[  2%] Completed 'mod2c'
[  2%] Built target mod2c
Scanning dependencies of target scopmath
[  3%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/scopmath.dir/scopmath_core/abort.cpp.o
[  3%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/scopmath.dir/scopmath_core/crout_thread.cpp.o
[  3%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/scopmath.dir/scopmath_core/newton_thread.cpp.o
[  3%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/scopmath.dir/scopmath_core/sparse_thread.cpp.o
[  3%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/scopmath.dir/scopmath_core/ssimplic_thread.cpp.o
[  4%] Linking CXX static library ../../../lib/libscopmath.a
[  4%] Built target scopmath
Scanning dependencies of target kin_deriv_header
[  4%] Generating expsyn.cpp
Translating  into expsyn.cpp
cvode_emit=0 cvode_not_allowed=0
Thread Safe
[  5%] Generating exp2syn.cpp
Translating  into exp2syn.cpp
cvode_emit=0 cvode_not_allowed=0
Thread Safe
[  5%] Generating hh.cpp
Translating  into hh.cpp
cvode_emit=0 cvode_not_allowed=0
Thread Safe
[  5%] Generating netstim.cpp
Translating  into netstim.cpp
cvode_emit=0 cvode_not_allowed=0
Notice: ARTIFICIAL_CELL is a synonym for POINT_PROCESS which hints that it
only affects and is affected by discrete events. As such it is not
located in a section and is not associated with an integrator
Thread Safe
[  5%] Generating passive.cpp
Translating  into passive.cpp
cvode_emit=0 cvode_not_allowed=0
Thread Safe
[  5%] Generating pattern.cpp
Translating  into pattern.cpp
cvode_emit=0 cvode_not_allowed=0
Notice: ARTIFICIAL_CELL is a synonym for POINT_PROCESS which hints that it
only affects and is affected by discrete events. As such it is not
located in a section and is not associated with an integrator
Thread Safe
[  5%] Generating stim.cpp
Translating  into stim.cpp
cvode_emit=0 cvode_not_allowed=0
Thread Safe
[  5%] Generating kinderiv.h by inspecting MOD files
[  5%] Built target kin_deriv_header
Scanning dependencies of target coreneuron
[  5%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/balance.cpp.o
[  5%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cellorder.cpp.o
[  5%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cellorder1.cpp.o
[  5%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cellorder2.cpp.o
[  6%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cvodestb.cpp.o
In file included from /home/ext_salvadordura_gmail_com/nrn/external/coreneuron/coreneuron/nrniv/cvodestb.cpp:29:0:
/home/ext_salvadordura_gmail_com/nrn/external/coreneuron/coreneuron/coreneuron.hpp:77:7: internal compiler error: in gen_type_die_with_usage, at dwarf2out.c:19525
 class CoreNeuron {
       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccqWAT4G.out file, please attach this to your bugreport.
make[2]: *** [external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cvodestb.cpp.o] Error 1
make[1]: *** [external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/all] Error 2
make: *** [all] Error 2

salvadord avatar Dec 24 '19 19:12 salvadord

Don't try to debug with prcellstate for now. I was misled by two unused variables in each coreneuron mod file that hold present voltage and conductance values on the NEURON side. The problem is definitely the arrival of a spike (likely from a NetStim) and that is where further diagnosis must be done.

nrnhines avatar Dec 24 '19 20:12 nrnhines

I'm trying to install coreneuron on google cloud VM with Centos 7, following the same steps as during the hackathon, but I'm getting the following error (@iomaganaris any suggestions?):

I missed all notifications during last few weeks as many GitHub notifications were part of spam emails  :confused:

[  6%] Building CXX object external/coreneuron/coreneuron/CMakeFiles/coreneuron.dir/nrniv/cvodestb.cpp.o
In file included from /home/ext_salvadordura_gmail_com/nrn/external/coreneuron/coreneuron/nrniv/cvodestb.cpp:29:0:
/home/ext_salvadordura_gmail_com/nrn/external/coreneuron/coreneuron/coreneuron.hpp:77:7: internal compiler error: in gen_type_die_with_usage, at dwarf2out.c:19525
 class CoreNeuron {
       ^
Please submit a full bug report,
with preprocessed source if appropriate.

@salvadord : we are using some C++14 features in CoreNEURON which are not supported by GCC v4.8.5. I believe we used newer compiler on the image during hackathon? Anything gcc >= 4.9.0 should work fine (I tested with gcc 4.9.0).

I have created separate issue https://github.com/BlueBrain/CoreNeuron/issues/228 to track this. For now, if you use newer GCC, everything should build fine.

pramodk avatar Dec 25 '19 16:12 pramodk

The dominant problem turns out to be different implementations for negexp for hoc Random and nrnran123.h::negexp. The former uses two random 32 bit picks of the Random123 uniform distribution to construct a full 53 bit mantissa for a double precision value (and then takes the -log of that). The latter uses a single 32 bit value, converts that to a uniform distribution (0-1) and takes the -log. NetPyNE makes use of the former and CoreNEURON is restricted to making use of the latter. A small change to NetPyNE causes NEURON to use the latter (consistent with CoreNEURON).

hines@hines-T7500:~/tmp/netpyne/examples/coreneuron$ git diff
diff --git a/netpyne/sim/run.py b/netpyne/sim/run.py
index 4a05c116..de935829 100644
--- a/netpyne/sim/run.py
+++ b/netpyne/sim/run.py
@@ -72,7 +72,8 @@ def preRun ():
             #cell.hRandom.Random123(sim.hashStr('NetStim'), cell.gid, cell.params['seed'])
             utils._init_stim_randomizer(cell.hRandom, 'NetStim', cell.gid, cell.params['seed'])
             cell.hRandom.negexp(1)
-            cell.hPointp.noiseFromRandom(cell.hRandom)
+            #cell.hPointp.noiseFromRandom(cell.hRandom)
+            cell.hPointp.noiseFromRandom123(utils.hashStr('NetStim'), cell.gid, cell.params['seed'])
         pop = sim.net.pops[cell.tags['pop']]
         if 'originalFormat' in pop.tags and pop.tags['originalFormat'] == 'NeuroML2_SpikeSource':
             if sim.cfg.verbose: print("== Setting random generator in NeuroML spike generator")
@@ -85,7 +86,8 @@ def preRun ():
                     stim['hRandom'].negexp(1)
                     # Check if noiseFromRandom is in stim['hObj']; see https://github.com/Neurosim-lab/netpyne/issues/219
                     if not isinstance(stim['hObj'].noiseFromRandom, dict):
-                        stim['hObj'].noiseFromRandom(stim['hRandom'])
+                        #stim['hObj'].noiseFromRandom(stim['hRandom'])
+                        stim['hObj'].noiseFromRandom123(sim.hashStr(stim['type']), cell.gid, stim['seed'])
 
     # handler for recording LFP
     if sim.cfg.recordLFP:

With this, tut2.py and tut2_coreneuron.py produce almost quantitatively identical values. eg

Original  : t=7.85, id=27
coreNEURON: t=7.85, id=27
...
Original  : t=996.30, id=9
coreNEURON: t=996.30, id=9

But not quite... there are a half dozen or so small differences at the least significant digit, the first being

Original  : t=7.98, id=18
coreNEURON: t=7.97, id=18

I will diagnose the origin of this first difference using pc.prcellstate.

However, the negexp differences between hoc Random.Random123 and nrnran123.h surprised me as I did not realize that hoc Random was calculating a full 53 bit mantissa double precision uniform distribution [0-1) and using that for all the real distributions. (note nrnran123.h supplies only a 32 bit resolution real uniform distribution and uses that to calculate negexp and normal). There are several possibilities for resolving this ranging from leaving everything as is, to reimplementing consistency with hoc Random distributions (uniform, negexp, and normal) on both the NEURON and CoreNEURON side. My initial prejudice is that a 32 bit resolution uniform random distribution is sufficient for neuroscience simulations and can be easily chosen on the NEURON side for result identity between NEURON and CoreNEURON.

nrnhines avatar Dec 25 '19 21:12 nrnhines

The state of id=18 is identical for NEURON and CoreNEURON at 8ms. (Hint it is possible to avoid the prcellstate issues with the CoreNEURON _v_unused and _g_unused variables in translated mod files by setting from 0 to 1 in the fragment

#ifndef NRN_PRCELLSTATE
#define NRN_PRCELLSTATE 1
#endif

in hh.cpp and exp2syn.cpp . Unfortunately, with coreneuron being an external submodule in my nrn build, I don't know how to set the equivalent of -DCMAKE_CXX_FLAGS='-DNRN_PRCELLSTATE=1' for the coreneuron portion of the build. Anyway, for at least this difference in spike times, the problem appears to be lack of least significant bit resolution rounding consistency in compare.py since the claim is that Original : t=7.98, id=18 coreNEURON: t=7.97, id=18 but the second line of the out.dat file from coreneuron is 7.975 18

I should mention that ease of debugging is greatly enhanced by sorted raster files (each line being a time gid pair where the time resolution is the least significant digit of dt) Then it is easy to use diff to find the first spike difference which implies a substantive state difference in that gid and then do a binary search using simulations with different tstop to find the time of the first variable difference in the state. At that point it is generally obvious why the difference exists.

nrnhines avatar Dec 25 '19 22:12 nrnhines

Thanks for figuring this out! Let me know how you want to fix the negexp issue; I will make any required changes to the netpyne repo.

salvadord avatar Dec 26 '19 17:12 salvadord

At present , for consistency with CoreNEURON, it is necessary to apply the change mentioned above. I've done that locally but I can't recommend that you do it in general unless you are comfortable changing the randomness of all your existing models that make use of NetStim and you are comfortable with a 32 bit resolution uniform real distribution instead of a 53 bit uniform real distribution ( uniform distributions involving one or more picks are used to form all the other distributions). For debugging, it is certainly useful to have the same quantitative randomness for NetStim in NEURON and CoreNEURON. In this early stage of CoreNEURON application, easy validation of result identity with NEURON is very useful.

As mentioned in an earlier comment, there remains a some small state differences between tut2.py and tut2_coreneuron.py. If you wish, I can pursue this to the underlying cause. But it would help if you can tell me how to use tut2.py to generate an asciil raster file with the same format as CoreNEURON generates. ie. "%.8g\t%d\n"

nrnhines avatar Dec 26 '19 18:12 nrnhines

@nrnhines I made the Random123 change in the netpyne "coreneuron" branch for now, until we confirm this is the way to go; that way we can comapare neuron vs coreneuron results.

I also modified tut2.py so it outputs data in the same format as coreneuron to the 'out_neuron.dat' file. Using diff showed the output is now identical for neuron and coreneuron. thanks!

salvadord avatar Dec 27 '19 22:12 salvadord