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

NEURON code generation #1107

Open
iomaganaris opened this issue Dec 4, 2023 · 0 comments
Open

NEURON code generation #1107

iomaganaris opened this issue Dec 4, 2023 · 0 comments
Labels
NEURON codegen Work toward NEURON code generation

Comments

@iomaganaris
Copy link
Contributor

iomaganaris commented Dec 4, 2023

This issue is created to track the progress of the code generation for then NEURON simulator in NMODL.

After some internal discussion we concluded that we should start with:

  1. Create a new protected branch which has slim CI related to NEURON to push small changes there related to the NEURON code generation. This way we don't have to wait for the full CIs of the master branch to push small changes and unblock people collaborating in this project. Intention of this branch is to be merged to master frequently and to be rebased on master as well frequently. (Create protected branch with minimal CI for NEURON code generation #1108)
  2. Add hook in nrnivmodl of NEURON to enable then use of an external nmodl binary to generate the code for the selected mechanisms. The rest of the build process in NEURON should stay the same with this. The idea of this is change is to be used by pip install neuron in the CI to accelerate the building of the NEURON version which is installed to be used with NMODL. (Add hook for external nmodl executable in nrnivmodl neuronsimulator/nrn#2625)
  3. After being able to generate a C++ file which can be compiled and loaded from NEURON special in Fix mechanism registration function for non POINT_PROCESSes #1111 we can start implementing the actual functions. Idea is to start with implementing the major functionality in NMODL for the fixed time step method which is very similar to CoreNEURON:
    a. https://github.com/neuronsimulator/nrn/blob/master/src/nrnoc/hh.mod to implement nrn_init, nrn_cur, nrn_state and _hh_reg functions which cover all the needed aspects of the density channels
    b. https://github.com/neuronsimulator/nrn/blob/master/src/nrnoc/expsyn.mod to handle the net_receive block
    c. https://github.com/neuronsimulator/nrn/blob/master/src/nrnoc/netstim.mod for handling stimulus
    based on those files we can also create needed integration tests
  4. Implement rest of more complicated NMODL constructs for fixed time step method (adding integration tests for those in the meantime)
  5. Implement variable timestep method and other NEURON particular functionality

Above is mainly based on inputs from @pramodk , @ohm314 , @1uc and myself.

Here is a table with all the NMODL construct and the related info for each one ( 🚧 WIP 🚧 )

NMODL DSL construct Functionality Related MOD file Issue PR Docs Comments Progress
Blocks - - - - - - -
DERIVATIVE Simple ODE solved in nrn_state() hh.mod link Done 🟢
ASSIGNED RANGE variables and arrays hh.mod #1126 link Done 🟢
PARAMETER Read and set PARAMETER variables from interpreter hh.mod #1106 link Under review 🔜
STATE Make sure that state variables can be used in nrn_state() hh.mod #1119 link Done 🟢
FUNCTION Functions work in HOC and Python hh.mod #1141 link WIP
PROCEDURE Procedures work in HOC and Python hh.mod #1141 link WIP
SOLVE Proper solver is used and simple nrn_state() works hh.mod #1119 link Done 🟢
BREAKPOINT Generate nrn_cur() hh.mod link
INITIAL RANGE and ARRAY variables are correctly initialised in finitialize() link
INITIAL STATE variables are correctly initialised in finitialize() link
INITIAL ION variables are correctly initialised in finitialize() link
LINEAR
NONLINEAR
NET_RECEIVE
KINETIC
UNITS
NEURON
VERBATIM
CONSTANT
BEFORE
AFTER
STEP
DISCRETE
FUNCTION_TABLE
CONSTRUCTOR
DESTRUCTOR
INDEPENDENT
Control Flow - - - - - - -
WHILE
IF
ELSE IF
ELSE
Other - - - - - - -
RANGE RANGE variable registration hh.mod #1111 link Done 🟢
RANGE RANGE variable functionality hh.mod #1119 link Done 🟢
GLOBAL Make sure that GLOBAL variables are registered, instantiated and used correctly link
THREADSAFE Handle properly GLOBAL variables hh.mod link
USEION ION variables registration and usage hh.mod link
READ ION variables read in nrn_cur() hh.mod link
WRITE ION variables set in nrn_cur() hh.mod link
REPRESENTS Probably do nothing in codegen about that. Just add it in a test hh.mod link
NONSPECIFIC_CURRENT Proper use in nrn_state()/nrn_cur() hh.mod #1185 link
SUFFIX Handle nothing as SUFFIX link
POINT_PROCESS POINT_PROCESS location works expsyn.mod #1106 link PR under review 🔜
~
->
FOR_NETCONS
LOCAL
TITLE
DEFINE
INCLUDE
SWEEP
CONDUCTANCE
PROTECT
FROM
WATCH
MUTEXLOCK
MUTEXUNLOCK
CONSERVE
COMPARTMENT
LONGITUDINAL_DIFFUSION
LAG
TABLE
VALENCE
ELECTRODE_CURRENT
POINTER
BBCOREPOINTER
EXTERNAL
COMMENT
SOLVE METHODs - - - - - - -
cnexp Solve simpler ODE hh.mod #1119 Done 🟢
euler
derivimplicit
sparse
runge
after_cvode
simeq
cvode_t
cvode_v
@iomaganaris iomaganaris added the NEURON codegen Work toward NEURON code generation label Dec 4, 2023
@JCGoran JCGoran pinned this issue Mar 8, 2024
@1uc 1uc unpinned this issue Jun 11, 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