NEURON installation with Python and MPICH2

Post Reply
Krishna Chaitanya
Posts: 70
Joined: Wed Jan 18, 2012 12:25 am
Location: University of Pavia

NEURON installation with Python and MPICH2

Post by Krishna Chaitanya »

Hi,

When I try to compile neuron source code (nrn-7.3 and iv-18) with the following options:

./configure --prefix=`pwd` --with-nrnpython=/usr/bin/python --with-iv=../iv --with-paranrn
make

It gives me the following errors:

/usr/bin/ld: /usr/local/lib/libmpich.a(allreduce.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmpich.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[3]: *** [libnrnmpi.la] Error 1
make[3]: Leaving directory `/home/cluster/mirror/nrn-7.2/src/nrnmpi'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/cluster/mirror/nrn-7.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/cluster/mirror/nrn-7.2'
make: *** [all] Error 2

I am using mpich2 compiled in the following way:

./configure --enable-shared
make
sudo make install

Kindly let me know where am I going wrong? Thank you.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON installation with Python and MPICH2

Post by hines »

That's puzzling because you --enabled-shared when building mpich2 but are linking against a static library when building NEURON.
And I guess,when you configure mpich2 without a --prefix, that it by default installs in /usr/local.
Do you have multiple versions of mpich2 installed. How many mpicc executables do you have under /usr?
Are there any libmpich.so\* files on your machine?
rth
Posts: 41
Joined: Thu Jun 21, 2012 4:47 pm

Re: NEURON installation with Python and MPICH2

Post by rth »

I have same problem.

My OS OpenSUSE 12.1,

Code: Select all

$uname -a
Linux beowolf 3.1.0-1.198-default #1 SMP Thu Nov 3 14:45:45 UTC 2011 (187dde0) x86_64 x86_64 x86_64 GNU/Linux
configuration for MPICH2 version 1.4.1p1

Code: Select all

$export  RSHCOMMAND=ssh; ./configure --prefix=/usr/local/paranrn --enable-f77 --enable-fc --enable-smpcoll --enable-nmpi-as-mpi --enable-mpe --enable-threads=default  --with-mpe && make -j 4 && sudo make install
I've also tried --enable-shared / --disable-shared as well as --with-device=ch_p4 or without device configuration. This manipulation didn't help.

I've exported evn. variables

Code: Select all

$export
.....
LD_LIBRARY_PATH="/usr/local/paranrn/lib64:/home/rth/local/lib:/home/rth/local/lib64:/home/rth/local/x86_64/lib"
.....
PATH="/usr/local/paranrn/bin:/home/rth/bin:/usr/lib64/mpi/gcc/openmpi/bin:/home/rth/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin"
.....
Test cpi from example directory works.

Configuration for NEURON

Code: Select all

$./configure --prefix=/home/rth/local/sofware/ --with-iv=/usr/local/iv --with-paranrn --with-mpi --with-pic && make -j 4 && sudo make install
I use iv from RPM installation, so it located in /usr/local/iv. Configuration finished quite well, but compilation failed. I've tried --with-pic / --without-pic. It doesn't work.

Code: Select all

make[3]: Entering directory `/home/rth/NEURON/nrn-7.2/src/gnu'
/bin/sh ../../libtool --tag=CXX   --mode=link mpic++  -g -O2   -o libneuron_gnu.la -rpath /home/rth/local/sofware/nrn/x86_64/lib64 ACG.lo Binomial.lo Complex.lo DiscUnif.lo Erlang.lo Geom.lo HypGeom.lo LogNorm.lo MLCG.lo NegExp.lo Normal.lo Poisson.lo RNG.lo Random.lo RndInt.lo SmplHist.lo SmplStat.lo Uniform.lo Weibull.lo builtin.lo d_avec.lo d_vec.lo  -lm -ldl
libtool: link: mpic++  -fPIC -DPIC -shared -nostdlib /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.6/crtbeginS.o  .libs/ACG.o .libs/Binomial.o .libs/Complex.o .libs/DiscUnif.o .libs/Erlang.o .libs/Geom.o .libs/HypGeom.o .libs/LogNorm.o .libs/MLCG.o .libs/NegExp.o .libs/Normal.o .libs/Poisson.o .libs/RNG.o .libs/Random.o .libs/RndInt.o .libs/SmplHist.o .libs/SmplStat.o .libs/Uniform.o .libs/Weibull.o .libs/builtin.o .libs/d_avec.o .libs/d_vec.o   -Wl,-rpath -Wl,/usr/local/paranrn/lib64 -Wl,-rpath -Wl,/usr/local/paranrn/lib64 -ldl -L/usr/local/paranrn/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.6 -L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.6/../../.. -lmpichcxx -lmpich /usr/local/paranrn/lib64/libopa.so /usr/local/paranrn/lib64/libmpl.a -lrt -lpthread -lstdc++ -lm -lc -lgcc_s /usr/lib64/gcc/x86_64-suse-linux/4.6/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/crtn.o  -O2   -Wl,-soname -Wl,libneuron_gnu.so.0 -o .libs/libneuron_gnu.so.0.0.0
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: /usr/local/paranrn/lib64/libmpl.a(mpltrmem.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/paranrn/lib64/libmpl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
I've double checked that I have no shared libraries in /usr/local/paranrn/lib64. Only *.a files. I wonder maybe I should reconfigure MPICH2 with -fPIC, to make these static library pointer independent?

Thanks,
Ruben
rth
Posts: 41
Joined: Thu Jun 21, 2012 4:47 pm

Re: NEURON installation with Python and MPICH2

Post by rth »

I've solved it. We need to add CFLAGS="-fPIC" and CXXFLAGS="-fPIC" as a parameters for ./configure
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON installation with Python and MPICH2

Post by hines »

On my ubuntu laptop I have an older version, mpich2-1.2.1p1, which I built using

'./configure' '--prefix=/home/hines/mpich2' '--enable-shared-libs=gcc'

I'm out of town away from my desktop, but will re-install the latest version on this laptop
and see what the enable shared option is these days. You can look yourself with
./configure --help
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON installation with Python and MPICH2

Post by hines »

To my suprise, my old mpich2 on this laptop only had static libraries because --enable-shared-libs=gcc
is a mispelled argument that is supposed to be --enable-sharedlibs=gcc . Also it is required to
have --enable-shared also. If one does not want static libraries, you have to also explicitly specify
--disable-shared . But I don't see a reason not to also build static libraries as well as shared. So on
this laptop a working configure for mpich2 (I did not bother to install fortran) is

./configure --prefix=/home/hines/mpich2 --enable-shared --enable-sharedlibs=gcc --disable-f77 --disable-fc
rth
Posts: 41
Joined: Thu Jun 21, 2012 4:47 pm

Re: NEURON installation with Python and MPICH2

Post by rth »

Does --enable-shared --enable-sharedlibs=gcc turn on -fPIC flag gcc? I'm not sure. Anyway with CFLAGS="-fPIC" and CXXFLAGS="-fPIC" under 1.4.1 (latest) version on MPICH2 it works good.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON installation with Python and MPICH2

Post by hines »

Yes. Both -fPIC and -DPIC
Post Reply