Compile NEURON mechanisms as C++#1597
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1597 +/- ##
==========================================
- Coverage 47.17% 47.16% -0.01%
==========================================
Files 543 543
Lines 112957 112964 +7
==========================================
- Hits 53287 53284 -3
- Misses 59670 59680 +10 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
b4efd79 to
58eb52f
Compare
d805de3 to
5ef8ed7
Compare
8a89527 to
0476abb
Compare
|
As a reference, the current master on my test system, using @alexsavulescu’s https://github.com/neuronsimulator/nrn-modeldb-ci/ has 5 build/link failures from 680 models, and 1 more runtime failure. The 5 are numbers 3658 97868 20212 144549 186768; I am putting these aside for now. With the current state of this PR, I have compilation errors from 50 of the remaining 675 models: I should note that I added At risk of not being very helpful, filenames from these models with compilation errors are: Looking through at the failures, I would summarise the causes as:
I think (1), (5), (7-9) deserve slightly more attention; some change to this PR may help. The others seem nearly hopeless without modifying the models themselves. As you can see, the current PR passes the CI we have running on GitHub. |
10f234d to
051256d
Compare
051256d to
2968020
Compare
2968020 to
3c92d32
Compare
3c92d32 to
8c084ff
Compare
8c084ff to
e977503
Compare
e977503 to
ef5d947
Compare
|
I re-ran https://github.com/neuronsimulator/nrn-modeldb-ci/ against the latest version of this branch, and now have a total of 38 failures from 680 models. As noted above, 5 of the 680 models did not build with I don't propose to repeat the exercise of trawling the logs and updating #1597 (comment) -- a summary of the change from the status then is:
The other causes listed above remain valid and are (at least mainly) responsible for the 33 remaining failures. |
|
https://bbpgitlab.epfl.ch/hpc/coreneuron/-/pipelines/35356 is testing this in the CoreNEURON pipeline with the Intel and NVIDIA compilers. Update: this passed. |
|
BlueBrain/CoreNeuron#770 is testing this against some more BBP models. As shown in BlueBrain/CoreNeuron#770 (comment), they now build and run. |
9985ea5 to
1378346
Compare
|
✔️ c197fc1 -> Azure artifacts URL |
|
Fix failing nrn-modeldb-ci models on windows. In summary, the bulk of the models below that have not been successfully built with this PR are those that use drand48 and related random functions that linux declares in stdlib.h. There are several ways to repair this, but they don't really pertain to this PR. Although it's possible that another substantive issue is hidden in a subsequent mod file after the nrnivmodl failure, that seems unlikely as all these are from the same family. So remaining nrn-modeldb-ci issues on windows should not delay merging this PR.
|
|
✔️ 6d656ac -> Azure artifacts URL |
|
✔️ 1d077e8 -> Azure artifacts URL |
|
✔️ 802603e -> Azure artifacts URL |
I just launched https://github.com/neuronsimulator/nrn-modeldb-ci/actions/runs/2515695442 using this URL and |
|
I also launched the CoreNEURON pipeline against this branch of NEURON: https://bbpgitlab.epfl.ch/hpc/coreneuron/-/pipelines/61107 (internal link). |
This looks fine ✅. |
|
✔️ 0f73f47 -> Azure artifacts URL |
|
✔️ 8c0bfcf -> Azure artifacts URL |
|
🚀 |
Overview
There has been a long-term effort to migrate NEURON from C to C++, including efforts such as #763.
Most NEURON source code files are already compiled as C++, two significant exceptions to this are:
.modfiles by thenocmodltranspilermesch,scopmath,sparse13andsundials.This PR aims to address the first one of these and generate C++ from
nocmodl.This constitutes progress towards part 2 of #708, and it also encompasses #384 and makes #397 obsolete.
Several other PRs have already been extracted from this one and merged: #1598, #1604, #1606, #1609.
Approach
The strategy of this PR has been, broadly, to:
.cwith.cppandCwithCXXthroughout the relevant parts of the build system.extern "C"and prefer C++ linkage -- this allows overloading.void consume_an_int();is interpreted as declaring an overload that takes no arguments, and a subsequent callconsume_an_int(42)will call thevoid consume_an_int(int);overload that was declared in an included header. This doesn't always work, as we cannot overload on return type.stoprun,mcell_ran4_legacy)dlsym(modl_reg)mech_api.hheader that defines the NEURON API that may be used in.modfiles.nocmodlstill emits a lot of declarations instead of including headers.[[deprecated]]overloads that mean legacy type-unsafe patterns that are common inVERBATIMblocks are still valid. Example:[[deprecated]], ...).modfiles that are invalid C++ to give valid generated code (nrnivmodl -legacytransformations cxx,nocmodl -t cxx).modfiles bundled with NEURON. The.modchanges in this PR are similar to the transformations made by the automated utility, but not identical (the bundled.modfiles additionally avoid all[[deprecated]]methods).nrntestto include Drop obsolete declarations. nrntest#26Status
In my local NEURON + CoreNEURON + NMODL + GPU build then all tests have passed. See #1597 (comment) and #1597 (comment) for updates on the status of the ModelDB CI (https://github.com/neuronsimulator/nrn-modeldb-ci/) when run against these changes. Roughly 33/675 models remain incompatible with C++.
TODO:
-fpermissiveand-legacytransformations cxxfor at least some of the models, so naively triggering the GitHub Actions workflow is not going to be enough.cc: @alexsavulescu