-
Notifications
You must be signed in to change notification settings - Fork 116
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
Compile NEURON mechanisms as C++ #1597
Conversation
Codecov Report
@@ 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
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
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
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:
.mod
files by thenocmodl
transpilermesch
,scopmath
,sparse13
andsundials
.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:
.c
with.cpp
andC
withCXX
throughout 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.h
header that defines the NEURON API that may be used in.mod
files.nocmodl
still emits a lot of declarations instead of including headers.[[deprecated]]
overloads that mean legacy type-unsafe patterns that are common inVERBATIM
blocks are still valid. Example:[[deprecated]]
, ...).mod
files that are invalid C++ to give valid generated code (nrnivmodl -legacytransformations cxx
,nocmodl -t cxx
).mod
files bundled with NEURON. The.mod
changes in this PR are similar to the transformations made by the automated utility, but not identical (the bundled.mod
files additionally avoid all[[deprecated]]
methods).nrntest
to 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:
-fpermissive
and-legacytransformations cxx
for at least some of the models, so naively triggering the GitHub Actions workflow is not going to be enough.cc: @alexsavulescu