Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support (/ Fix) code generation with Artificial cells for NEURON simulator #1353

Open
3 of 4 tasks
pramodk opened this issue Jul 17, 2024 · 0 comments
Open
3 of 4 tasks
Labels
NEURON codegen Work toward NEURON code generation

Comments

@pramodk
Copy link
Contributor

pramodk commented Jul 17, 2024

Overview of the issue

When testing the ringtest model with NMODL as transpiler for NEURON, I see that the spikes are not generated.

Expected result/behavior

Spike results between nmodl and nocmodl transpiler should be the same

Setup

  • NEURON Version: master
  • NMODL Version: master
  • Installation method: typical CMake
cmake .. -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_RX3D=OFF -DNRN_ENABLE_CORENEURON=ON -DCMAKE_INSTALL_PREFIX=$(pwd)/install

Minimal working example

Model Repisotiry

git clone https://github.com/neuronsimulator/ringtest.git
cd ringtest

I applied below patch so that it's easy to test nocmodl and nmodl:

$ git diff
diff --git a/ring.py b/ring.py
index f2071ff..6301f10 100644
--- a/ring.py
+++ b/ring.py
@@ -102,8 +102,11 @@ class Ring(object):

         if not settings.pc.gid_exists(self.gidstart):
             return
-
-        self.stim = h.NetStim()
+        import os
+        if os.getenv("NETSTIM_NMODL") == '1':
+            self.stim = h.NetStimNMODL()
+        else:
+            self.stim = h.NetStim()

In order to test like the above, I created a copy of netstim.mod:

cp nrn/src/nrnoc/netstim.mod mod/netstim_nmodl.mod
sed -i '' 's/NetStim/NetStimNMODL/g' mod/netstim_nmodl.mod

Build mod files:

<nrn-install>/bin/nrnivmodl -nmodl <nrn-install>/bin/nmodl mod/

Check the spikes between nocmodl and nmodl:

$ ./arm64/special -python ringtest.py
NEURON -- VERSION 9.0a-299-g314d42222+ pramodk/docs-enh (314d42222+) 2024-07-16
...
0.000982046s wrote 688 spikes

vs

$ NETSTIM_NMODL=1 ./arm64/special -python ringtest.py
...
0.000211954s wrote 0 spikes

i.e. 688 spikes ve 0

Preliminary Investigation

Yesterday I was quickly looking through the generated code and I noticed the following. Maybe separate issues for each of these might be better (?):

  • RANDOM construct is not handled
    - e.g. stream allocation in nrn_alloc() is missing
  • VERBATIM block contents is not printed (not the main cause)
  • ARTIFICIAL_CELL should have a call to artcell_net_send() instead of net_send()
  • mechname_reg() missing call to add_nrn_has_net_event(mech_type)

(I might be missing a few other aspects, which I will add here if I see/remember but you can easily see these as stimulus is not working)

@pramodk pramodk added the NEURON codegen Work toward NEURON code generation label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NEURON codegen Work toward NEURON code generation
Projects
None yet
Development

No branches or pull requests

1 participant