BlueBrain / spack-packages

Repository of spack external packages
7 stars 6 forks source link

nrnivmodl fails if neuron was installed using spack #7

Closed sharkovsky closed 7 years ago

sharkovsky commented 7 years ago

trying to run nrnivmodl on a directory results in the following output:

cremones@daint102:ringtest (master) $ nrnivmodl mod
Creating x86_64 directory for .o files.

/users/cremones/test-use-cases/ringtest
ls: cannot access mod/*.inc: No such file or directory
mod/halfgap.mod
halfgap.mod
/users/cremones/software/spack-install/cray-CNL-haswell/intel-17.0.0.098/neuron-master-xefdyhbhchxb7vdt4pwowmbcozvmq77b/x86_64/bin/nocmodl halfgap
Translating halfgap.mod into halfgap.c
Thread Safe
/users/cremones/software/spack/lib/spack/env/intel/icc -DHAVE_CONFIG_H -I. -I.. -I/users/cremones/software/spack-install/cray-CNL-haswell/intel-17.0.0.098/neuron-master-xefdyhbhchxb7vdt4pwowmbcozvmq77b/include/nrn -I/users/cremones/software/spack-install/cray-CNL-haswell/intel-17.0.0.098/neuron-master-xefdyhbhchxb7vdt4pwowmbcozvmq77b/x86_64/lib     -O2 -g  -c halfgap.c
Spack compiler must be run from Spack! Input 'SPACK_PREFIX' is missing.
/users/cremones/software/spack-install/cray-CNL-haswell/intel-17.0.0.098/neuron-master-xefdyhbhchxb7vdt4pwowmbcozvmq77b/x86_64/bin/nrniv_makefile:101: recipe for target 'halfgap.o' failed
make: *** [halfgap.o] Error 1

this seems to happen because in the file /users/cremones/software/spack-install/cray-CNL-haswell/intel-17.0.0.098/neuron-master-xefdyhbhchxb7vdt4pwowmbcozvmq77b/x86_64/bin/nrniv_makefile is hard-coded the path to the compiler, i.e. at line 47: CC = /users/cremones/software/spack/lib/spack/env/intel/icc

is there a way around this?

pramodskumbhar commented 7 years ago

Ahh.. I see !

nrnivmodl is embedding Spack wrappers itself! In the install method we just have to replace these variables with actual compilers. I can fix that.

Just FYI : if you do spack edit mpich then you can see filter_compilers method where actual compilers are available via self.compiler.cc

pramodskumbhar commented 7 years ago

12 fix this issue now. I have built neuron with all possible compilers on Cray:

$ spack find -v neuron
==> 5 installed packages.
-- cray-CNL-haswell / cce@8.5.4 ---------------------------------
neuron@develop+cross-compile+mpi+multisend+python~rx3d~shared

-- cray-CNL-haswell / gcc@4.9.3 ---------------------------------
neuron@develop+cross-compile+mpi+multisend+python~rx3d~shared

-- cray-CNL-haswell / intel@17.0.0.098 --------------------------
neuron@develop+cross-compile~debug+mpi+multisend~profile+python+static  neuron@develop+cross-compile+mpi+multisend+python~rx3d~shared

-- cray-CNL-haswell / pgi@16.4.0 --------------------------------
neuron@develop+cross-compile+mpi+multisend+python~rx3d+shared

For building special, if you are linking with Python then you have to make sure to use dynamic flag if Python is used in shared library mode as:

nrnivmodl -loadflags "-dynamic" .