Bring NMODL transpiler under NEURON#3333
Conversation
Fixes BlueBrain/nmodl#1178 NMODL Repo SHA: BlueBrain/nmodl@26899cc
The previous behaviour for
KINETIC states {
~ x + y << 42.0
}
was to print a warning and continue as if the line didn't exist. The new
behaviour is to throw an error, because it's unclear why ignoring the
line could ever lead to a correct translation of the MOD file.
NMODL Repo SHA: BlueBrain/nmodl@9292c18
* Format Python files with `black`. * Enable `black` formatter. NMODL Repo SHA: BlueBrain/nmodl@40aa0bf
What's meant is things like `celsius`. NMODL Repo SHA: BlueBrain/nmodl@c8818c8
When encountering an indexed `COMPARTMENT` block:
COMPARTMENT i, volume_expr { species }
All state variables are searched if they match they match the pattern
`"{species}[%d]"`. For each matching state variables, we obtain the
value of the array index and substitute the name of the array index with
its value in `volume_expr`. This is then stored in the array of
compartment factors.
Check that the resulting derivatives are divided by the volume
of the compartment.
NMODL Repo SHA: BlueBrain/nmodl@219a3ed
NMODL Repo SHA: BlueBrain/nmodl@9873e06
Co-authored-by: Nicolas Cornu <me@alkino.fr> NMODL Repo SHA: BlueBrain/nmodl@c818f16
…1234) This can be reproduced by: cmake -B build && cmake --build build --target=generate_references i.e. call `--target=generate_references` without building it first. It would complain about missing `bin/nmodl`. NMODL Repo SHA: BlueBrain/nmodl@735b11d
Store the forward and reverse rates in local variables, e.g.: ``` rate = 42.0 ~ a <-> b (1.0*rate, 2.0*rate) ``` is converted to: ``` LOCAL kf0_, kb0_ rate = 42.0 kf0_ = 1.0*rate kb0_ = 2.0*rate ~ a <-> b (kf0_, kb0_) ``` This solves a bug that assigning to `rate` between two reaction equation statements would mean the first line sees the value meant for the second line. NMODL Repo SHA: BlueBrain/nmodl@868ce13
In NRN we depend on the target `nmodl` to ensure that when we run `nrnivmodl -coreneuron` the binary `nmodl` exists. We need to also ensure that everything `nmodl` needs to works is present. This fixes a dependency bug on certain copied files by making the target for copying the files a dependency of `nmodl`. NMODL Repo SHA: BlueBrain/nmodl@b78c3f3
* Fix array variables.
These are the code generation changes required for:
#2779
The solution is to fill `nrn_prop_param_size` with the number of
doubles, not number of variables.
NMODL Repo SHA: BlueBrain/nmodl@f6821ce
…dl#1244) - If `-DNMODL_ENABLE_PYTHON_BINDINGS=OFF` then there is no need to generate AST and other wrapper classes for Pybind11. - Using sympy-based solvers does not require Python bindings to be enabled. Avoid confusing warning when using nmodl binary. - When someone tries to use the nmodl module via Python, the warning is still preserved. ```console $ nmodl mod_examples/sparse.mod [NMODL] [warning] :: Python bindings are not available with this installation .. $ nmodl mod_examples/sparse.mod $ python3.11 -c "import nmodl" [NMODL] [warning] :: Python bindings are not available with this installation ``` NMODL Repo SHA: BlueBrain/nmodl@8eb88e4
- when neuron is built with nmodl then nmodl related files should be installed in <prefix>/ and not in <prefix>/nmodl/.data - <prefix>/nmodl/.data is used when we build standalone wheels - add one mod file using sparse solver - nmodl will automatically use sympy solver NMODL Repo SHA: BlueBrain/nmodl@2fb037e
It was dead code NMODL Repo SHA: BlueBrain/nmodl@8285f26
Instead of setting the conductance as: g = g + g0 * exp(-(t - t0)/tau) we set it to g += g0 where `g0` is the argument passed to NET_RECEIVE, i.e. the weight. This allows for an analytic solution, that can be tested. NMODL Repo SHA: BlueBrain/nmodl@ada65df
Random collection of fixups to make hh.mod work. --------- Co-authored-by: Luc Grosheintz <luc.grosheintz@gmail.com> NMODL Repo SHA: BlueBrain/nmodl@b451d39
NMODL Repo SHA: BlueBrain/nmodl@299c249
The idea is to generate the references, but not check that there are no differences. Doing so allows us to push the changes automatically to `nmodl-references`. NMODL Repo SHA: BlueBrain/nmodl@0e69948
|
✔️ 3894e81 -> Azure artifacts URL |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3333 +/- ##
==========================================
+ Coverage 67.05% 68.31% +1.25%
==========================================
Files 571 681 +110
Lines 111076 116420 +5344
==========================================
+ Hits 74480 79527 +5047
- Misses 36596 36893 +297 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There appear to be two issues which do not appear in the CI, but I'm not sure whether are reproducible (don't have another Apple machine to compare):
CMake build flags:
The first one is not a deal-breaker since people usually use the default Clang on MacOS, though the second one is a bit sketchy. |
|
I thought I'd look into as that is something I've had a bit of experience with. to check that the basic build was working. Trying again after I get It is a bit ambiguous what is needed for that, but in analogy to the output of and get After a bit of searching and trial and error I see it needs to be (for the build) I suppose some of this is a consequence of an assumption that python needs to be dynamically determined at nmodl runtime ( Now back to looking into |
3894e81 to
4f17bd9
Compare
|
@nrnhines good catch, I didn't try that configuration out at all, I pushed a change so now it should work :) Note that |
|
✔️ 4f17bd9 -> Azure artifacts URL |
Thanks! Just to clarify the present situation. ends with a nice summary of what I desired (if I'm interpreting it correctly): but near the end of the build, one is told that Leaving out the install and just using Per your suggestion, I also tried I wonder about the precise meaning of
At the moment I see issues with the neurondemo mod files with respect to coreneuron. They are rather trivial and there is no need to deal with them now.
|
|
Here is a progress note about gcc-14 and I guess to get further one has to figure out how to force an alternative to the cmake determined My cmake version is 3.26.3 |
|
✔️ 3bc292a -> Azure artifacts URL |
|
@nrnhines thanks for checking, the linker issue should be fixed now. |
It does get a lot further now (using my above exports, cmake, ninja, on my apple M1). Near the end of the build, One can focus on the details with Note: I'm not very familiar with nmodl. If this is a consequence of runtime dynamic linking of python, it is a puzzle to me why clang has no problem (it used |
6801782 to
14e27c4
Compare
|
✔️ 14e27c4 -> Azure artifacts URL |
|
Just to finish up the gcc-14 comments. The following works on my Apple M1 No manual exports needed. edit: Nevertheless, this issue should not prevent merging this PR to master. It can be fixed in subsequent PR. |
14e27c4 to
709ab85
Compare
|
|
✔️ 709ab85 -> Azure artifacts URL |



This is a cleaned-up version of #3272, where all of the CMake changes were squashed into one commit (this one 3894e81), and it has been rebased on latest
master.Closes #3308.
Content below the line is taken from #3265 and updated to reflect the necessary changes.
Steps To Follow
Here are 5 major steps that we need to follow:
Clone NRN and NMODL Repos
Install
git-filter-repoPrepare NMODL Repo
Use
git filter-repoto do all hard work 👷We now have a "cleaned" version of NMODL repository. See if generated structure is what you want:
We can now push this trimmed-down version of the repo into neuronsimulator org to verify if the commits and PRs are properly linked to original NMODL repo:
See the result at https://github.com/neuronsimulator/nmodl-test.
Merge NMODL Repo into NEURON
Now comes the part of merging the two repositories. Add "cleaned" nmodl repo as remote and merge the two repos as:
This should merge the repos cleanly. We can push this to nrn branch:
"Marriage" of CMake and Build System
We have now nmodl and nrn repo merged. But there are various things that needs to be happened:
Update Spack recipe (?)due to BBP closure, any Spack recipes will need to be updated by third parties