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

Usage of POINTER variable under PROCEDURE or other blocks result into compilation error (CoreNEURON) #1782

Closed
pramodk opened this issue Apr 19, 2022 · 0 comments · Fixed by BlueBrain/mod2c#79, BlueBrain/CoreNeuron#804 or #1791

Comments

@pramodk
Copy link
Member

pramodk commented Apr 19, 2022

Context

#1622 has added the support for usage of POINTER variables for CoreNEURON. But, if we use such variable in block like PROCEDURE then we get compilation error.

Expected result/behavior

MOD file should compile just fine.

NEURON setup

  • Version: master
  • Installation method: default CMake build with coreneuron support

Minimal working example - MWE

  • Update the existing test as:
diff --git a/test/coreneuron/mod/axial.inc b/test/coreneuron/mod/axial.inc
index cca9c26a..77aba1d5 100644
--- a/test/coreneuron/mod/axial.inc
+++ b/test/coreneuron/mod/axial.inc
@@ -26,6 +26,10 @@ ASSIGNED {
     pim (nA) : parent im
 }

+PROCEDURE foo() {
+    pim = pim + 1
+}
+
  • Try to compile test MOD files:
build git:(master) ✗ ./install/bin/nrnivmodl-core ../test/coreneuron/mod
[INFO] Running: make -j4 -f /Users/kumbhar/Downloads/nrn/build/install/share/coreneuron/nrnivmodl_core_makefile ROOT=/Users/kumbhar/Downloads/nrn/build/install MODS_PATH=x86_64/corenrn/mod2c BUILD_TYPE=SHARED NRN_PRCELLSTATE=0
Default NMODL flags:
x86_64/corenrn/mod2c/axial.cpp: In function 'int coreneuron::foo_axial(int, int, double*, coreneuron::Datum*, coreneuron::ThreadDatum*, coreneuron::NrnThread*, double)':
x86_64/corenrn/mod2c/axial.cpp:120:17: error: '_nt_data' was not declared in this scope
  120 | #define pim     _nt_data[_ppvar[2*_STRIDE]]
      |                 ^~~~~~~~
x86_64/corenrn/mod2c/axial.cpp:241:4: note: in expansion of macro 'pim'
  241 |    pim = pim + 1.0 ;
      |    ^~~
x86_64/corenrn/mod2c/axial_pp.cpp: In function 'int coreneuron::foo_AxialPP(int, int, double*, coreneuron::Datum*, coreneuron::ThreadDatum*, coreneuron::NrnThread*, double)':
x86_64/corenrn/mod2c/axial_pp.cpp:134:17: error: '_nt_data' was not declared in this scope
  134 | #define pim     _nt_data[_ppvar[4*_STRIDE]]
      |                 ^~~~~~~~
x86_64/corenrn/mod2c/axial_pp.cpp:333:4: note: in expansion of macro 'pim'
  333 |    pim = pim + 1.0 ;
      |    ^~~
make: *** [x86_64/corenrn/build/axial.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [x86_64/corenrn/build/axial_pp.o] Error 1
  • CMake build commands:
git clone [email protected]:neuronsimulator/nrn.git
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCORENRN_ENABLE_MPI=ON  -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_RX3D=OFF
cmake --build . --

Additional info

This issue came across while testing MOD file reported in suny-downstate-medical-center/netpyne#667.

pramodk added a commit to BlueBrain/CoreNeuron that referenced this issue Apr 25, 2022
* POINTER variables were not usable in PROCEDURE, FUNCTION and many
other blocks.
* We now redefine such POINTER variables us _nt which is an argument
 to all necessary functions

fixes  neuronsimulator/nrn#1782
pramodk added a commit to BlueBrain/CoreNeuron that referenced this issue Apr 25, 2022
…804)

* POINTER variables were not usable in PROCEDURE, FUNCTION and many
other blocks.
* We now redefine such POINTER variables us _nt which is an argument
 to all necessary functions

fixes  neuronsimulator/nrn#1782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment