diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb2029b..4498417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,10 +30,20 @@ jobs: nrnivmodl -coreneuron mod/ - name: Run ringtest run: | - # Test NEURON - python ringtest.py -tstop 100 - diff spk1.std reference_data/spk1.100ms.std.ref - # Test CoreNEURON - python ringtest.py -coreneuron -tstop 100 - sortspike spk1.std spk1.coreneuron.std - diff spk1.coreneuron.std reference_data/spk1.100ms.std.ref + # Get NEURON major version + NRNVER=$(python -c 'import neuron; print(neuron.__version__.split(".")[0])') + echo "NEURON major version: ${NRNVER}" + + if [ "$NRNVER" -ge 9 ]; then + # 8.2 coreneuron mod files comment out TABLE statements + # so only do the tests if >= 9 + + # Test NEURON + python ringtest.py -tstop 100 + diff spk1.std reference_data/spk1.100ms.std.ref + + # Test CoreNEURON + python ringtest.py -coreneuron -tstop 100 + sortspike spk1.std spk1.coreneuron.std + diff spk1.coreneuron.std reference_data/spk1.100ms.std.ref + fi diff --git a/args.py b/args.py index 0c43683..cec9c97 100644 --- a/args.py +++ b/args.py @@ -42,6 +42,19 @@ type=float, default=100.) +parser.add_argument("-method", + dest='method', + metavar='N', + help="0-fixed, 1-global cvode, 2-local cvode", + type=int, + default=0) + +parser.add_argument("-2nd_order_thresh", + dest='thresh_order2', + action='store_true', + help="2nd order correct threshold detection (cvode only)", + default=False) + parser.add_argument("-gran", metavar='N', help="global Random123 index (default 0)", diff --git a/ringtest.py b/ringtest.py index 00345ca..be04886 100644 --- a/ringtest.py +++ b/ringtest.py @@ -24,6 +24,12 @@ # stop time of simulation tstop = args.tstop +# Which integration method to use +method = args.method + +# Cvode threshold detection --- first or second order +condition_order = 2 if args.thresh_order2 else 1 + # whether to randomize cell parameters randomize_parameters = args.rparm @@ -76,6 +82,9 @@ print ("%s %s" % (str(nbranch), str(ncompart))) print ("nring=%d\ncell per ring=%d\nncell_per_type=%d" % (nring, ncell, ncell_per_type)) print ("ntype=%d" % ntype) + methname=["fixed", "global vardt, ", "local vardt, "] + co = "condition_order="+str(condition_order) if method else "" + print ("method = %s %s" % (methname[method], co)) #from cell import BallStick h.load_file("cell.hoc") @@ -195,6 +204,11 @@ def create_rings(): ## Initialize ## + if method > 0: + h.cvode.condition_order(condition_order) + h.cvode.active(1) + if method == 2: + h.cvode.use_local_dt(1) pc.set_maxstep(10) h.stdinit() timeit("initialized", settings.rank)