nrn icon indicating copy to clipboard operation
nrn copied to clipboard

nrnivmodl is always retranslating/recompiling mod files

Open pramodk opened this issue 5 years ago • 2 comments

When I use nrnivmodl on the mod files multiple times without changing, I see that mod files get retranslated and recompiled:

pip3 install neuron-nightly
→ nrnivmodl mod/
INFO : Using neuron-nightly Package (Developer Version)
/usr/bin/xcrun
/Users/kumbhar/workarena/repos/bbp/testcorenrn
ls: mod//*.inc: No such file or directory
mod//Gfluct3.mod mod//hhderiv.mod mod//hhkin.mod mod//hhwatch.mod mod//nacum.mod
Gfluct3.mod hhderiv.mod hhkin.mod hhwatch.mod nacum.mod
 -> Compiling mod_func.c
gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c mod_func.c -o mod_func.o
 -> NMODL Gfluct3.mod
 -> NMODL hhderiv.mod
 -> NMODL hhkin.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhderiv.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhkin.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl Gfluct3.mod
Translating Gfluct3.mod into Gfluct3.c
Translating hhkin.mod into hhkin.c
Translating hhderiv.mod into hhderiv.c
Thread Safe
Thread Safe
Thread Safe
 -> NMODL hhwatch.mod
 -> NMODL nacum.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl nacum.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhwatch.mod
Translating nacum.mod into nacum.c
Translating hhwatch.mod into hhwatch.c
Thread Safe
Thread Safe
 -> Compiling x86_64/Gfluct3.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/Gfluct3.c -o x86_64/Gfluct3.o)
 -> Compiling x86_64/hhkin.c
 -> Compiling x86_64/hhderiv.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhkin.c -o x86_64/hhkin.o)
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhderiv.c -o x86_64/hhderiv.o)
 -> Compiling x86_64/hhwatch.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhwatch.c -o x86_64/hhwatch.o)
 -> Compiling x86_64/nacum.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/nacum.c -o x86_64/nacum.o)
 => LINKING library x86_64/libnrnmech.dylib Mod files: Gfluct3.mod hhderiv.mod hhkin.mod hhwatch.mod nacum.mod
(cd .. ; g++ -O2 -DVERSION_INFO='8.0.dev122' -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -fPIC  -I /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include -o x86_64/libnrnmech.dylib -Wl,-install_name,@rpath/libnrnmech.dylib \
	  x86_64/mod_func.o x86_64/Gfluct3.o x86_64/hhderiv.o x86_64/hhkin.o x86_64/hhwatch.o x86_64/nacum.o -L/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/lib -lnrniv -Wl,-rpath,/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/lib    -lreadline)
(cd .. ; rm -f x86_64/.libs/libnrnmech.so ; mkdir -p x86_64/.libs ; ln -s ../../x86_64/libnrnmech.dylib x86_64/.libs/libnrnmech.so)
Successfully created x86_64/special

and second time:

→ nrnivmodl mod/
INFO : Using neuron-nightly Package (Developer Version)
/usr/bin/xcrun
/Users/kumbhar/workarena/repos/bbp/testcorenrn
ls: mod//*.inc: No such file or directory
mod//Gfluct3.mod mod//hhderiv.mod mod//hhkin.mod mod//hhwatch.mod mod//nacum.mod
Gfluct3.mod hhderiv.mod hhkin.mod hhwatch.mod nacum.mod
 -> Compiling mod_func.c
 -> NMODL hhderiv.mod
gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c mod_func.c -o mod_func.o
 -> NMODL Gfluct3.mod
 -> NMODL hhkin.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhkin.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhderiv.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl Gfluct3.mod
Translating hhkin.mod into hhkin.c
Translating hhderiv.mod into hhderiv.c
Translating Gfluct3.mod into Gfluct3.c
Thread Safe
Thread Safe
Thread Safe
 -> NMODL nacum.mod
 -> NMODL hhwatch.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl nacum.mod
MODLUNIT=/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/share/nrn/lib/nrnunits.lib \
	  /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/bin/nocmodl hhwatch.mod
 -> Compiling x86_64/Gfluct3.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/Gfluct3.c -o x86_64/Gfluct3.o)
Translating nacum.mod into nacum.c
Thread Safe
Translating hhwatch.mod into hhwatch.c
Thread Safe
 -> Compiling x86_64/hhderiv.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhderiv.c -o x86_64/hhderiv.o)
 -> Compiling x86_64/hhkin.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhkin.c -o x86_64/hhkin.o)
 -> Compiling x86_64/hhwatch.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/hhwatch.c -o x86_64/hhwatch.o)
 -> Compiling x86_64/nacum.c
(cd .. ; gcc -O2   -I. -I..   -I/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include  -I/usr/local/Cellar/open-mpi/4.0.3/include -fPIC -c x86_64/nacum.c -o x86_64/nacum.o)
 => LINKING library x86_64/libnrnmech.dylib Mod files: Gfluct3.mod hhderiv.mod hhkin.mod hhwatch.mod nacum.mod
(cd .. ; g++ -O2 -DVERSION_INFO='8.0.dev122' -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -fPIC  -I /Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/include -o x86_64/libnrnmech.dylib -Wl,-install_name,@rpath/libnrnmech.dylib \
	  x86_64/mod_func.o x86_64/Gfluct3.o x86_64/hhderiv.o x86_64/hhkin.o x86_64/hhwatch.o x86_64/nacum.o -L/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/lib -lnrniv -Wl,-rpath,/Users/kumbhar/Library/Python/3.7/lib/python/site-packages/neuron/.data/lib    -lreadline)
(cd .. ; rm -f x86_64/.libs/libnrnmech.so ; mkdir -p x86_64/.libs ; ln -s ../../x86_64/libnrnmech.dylib x86_64/.libs/libnrnmech.so)
Successfully created x86_64/special

This is not specific to wheel but also happens with cmake installed neuron (haven't checked autoconf).

pramodk avatar Jun 23 '20 12:06 pramodk

I'm experimenting with the autotools version.

I wonder if this in an ambiguity of symbolic link dates so that different machines or different make versions have different behavior. I.e. my GNU Make 4.1 and my linux Ubuntu 18.04.4 LTS in hines@hines-T7500:~/neuron/nrnmpi/share/nrn/demo/release shows

$ ls -l x86_64/capump*
-rw-r--r-- 1 hines hines 9994 Jun 24 07:31 x86_64/capump.c
-rw-r--r-- 1 hines hines  279 Jun 24 07:31 x86_64/capump.lo
lrwxrwxrwx 1 hines hines   13 Jun 24 07:32 x86_64/capump.mod -> ../capump.mod

and nrnivmodl translates no mod file and compiles only mod_func.c and afterwards

$ ls -l x86_64/capump*
-rw-r--r-- 1 hines hines 9994 Jun 24 07:31 x86_64/capump.c
-rw-r--r-- 1 hines hines  279 Jun 24 07:31 x86_64/capump.lo
lrwxrwxrwx 1 hines hines   13 Jun 24 07:37 x86_64/capump.mod -> ../capump.mod

This behavior also is the same if i move up one folder and nrnivmodl release. I.e. mod files only translated and compiled first time.

On the other hand, I am getting the translate/compile of all mod files for every nrnivmodl when using a cmake build. But don't know why yet.

nrnhines avatar Jun 24 '20 11:06 nrnhines

Looking at bin/nrnmech_makefile it appears that

# Build c files with nocmodl
$(MODC_DIR)/%.c: $(MODS_PATH)/%.mod | $(MODC_DIR)

can never be skipped because the current folder is x86_64 and MODC_DIR is x86_64. Changing to %.c: %.mod helps but of course also need to change consistently in a few other places as well. However, it might be better to do a larger review where OBJS_DIR, MODC_DIR, MODS_PATH , and the current working directory where make is being run are all consistent and useful.

nrnhines avatar Jun 24 '20 14:06 nrnhines