Skip to content

Commit

Permalink
cvode and condition_order args (#30)
Browse files Browse the repository at this point in the history
* Don't test 8.2, spk1.100ms.std.ref is for usetable_hh=1
  • Loading branch information
nrnhines authored Jan 6, 2025
1 parent 7d1aee7 commit b096d53
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
14 changes: 14 additions & 0 deletions ringtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b096d53

Please sign in to comment.