[CPMD-list] hi
Axel Kohlmeyer
axel.kohlmeyer at theochem.ruhr-uni-bochum.de
Thu Sep 16 18:29:44 CEST 2004
hi everybody,
a few more remarks about intel compiler shared libraries
and static linking.
indeed the default setting of the intel compiler to dynamically
link the cxa (=C++ !!) runtime library is a stupid thing.
well the whole inflation of shared libraries on linux machines is.
most of the time it is wasted, because you
a) don't have a lot of applications referencing it and
b) since many of those libraries are still under development,
most of the time the next release of the shared library
incompatible to the previous one. so you either have to
recompile your application or install two versions of the
shared library...
the latter case is extremely painful, if you want to support
binaries, that were compiled with older compilers. some cpmd
projects can take a looong time, and you really don't want to
switch your executables in the middle of the trajectory...
so linking the compiler runtime statically is the only sensible
solution. now linking _everything_ statically does not help
you either, if you have a linux machine with a newer glibc
(i think this starts with glibc 2.2.5 or so). since even for
statically linked binaries, some parts of glibc try to open
(via dlopen) some shared libraries. now if you have linked
libc statically you need the _exact_ _same_ version of the
shared libraries installed. only if you link libc/libm/libpthread
dynamically you can be somewhat assured to be able to use your
binaries on newer installations (but not on older ones unless
you ship the matching libc/ld-linux.so/etc.. and use some
really weird dynamic linker magic).
this is usually achieved (at least with ifort version 7.1 and 8.0/8.1)
by using -static-libcxa.
after linking you can check it by issuing something like:
[29|18:18]~> ldd cpmd.x
libm.so.6 => /lib/i686/libm.so.6 (0x40024000)
libc.so.6 => /lib/i686/libc.so.6 (0x40047000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
you should only see libm, libc, the shared linker
and optionally libpthread here.
if there are still some additional dependencies to shared libraries
you can deal with them by modifying the LFLAGS definition in
the makefile. you simply bracket the libraries, you want to get
linked statically with:
-Xlinker -Bstatic
and:
-Xlinker -Bdynamic
while mentioning intel compiler flags. please note, that
the latest release, version 8.1, has redefined the '-fast'
convenience option to include the -ipo flag for interprocedural
optimization. on my tests using -ipo made cpmd about 10% slower(!)
while increasing compilation time and memory requirements for
compilation astronomically.
best regards,
axel kohlmeyer.
On Thu, 16 Sep 2004, Wolfram Quester wrote:
WQ> Hi Reuti,
WQ>
WQ> On Thu, Sep 16, 2004 at 10:40:01AM +0200, Reuti wrote:o
WQ> > Hi,
WQ> >
WQ> > because we want most of the time the Intel libraries statical linked into to
WQ> > programs (for exactly the reason, that they not on all the nodes), I rename all
WQ> > the file in /opt/intel_fc_80/lib (same with intel_cc_80) to solve this problem
WQ> > with:
WQ> >
WQ> > $ rename .so .so.disabled *.so
WQ> >
WQ> > This way I don't have to touch the make files in each program, and the .a libs
WQ> > will be used during linking.
WQ> >
WQ> > Cheers - Reuti
WQ> >
WQ> > PS: Before you apply any patch to your Intel compiler, you have to rename them
WQ> > back.
WQ> >
WQ>
WQ> This seems complicated. Isn't it enough to add -static during the linker
WQ> stepp in your Makefile, as
WQ> LFLAGS=... -static ...
WQ> or
WQ> LDFLAGS=... -static ...
WQ>
WQ> With best regards,
WQ>
WQ> Wolfi
WQ>
--
=======================================================================
Dr. Axel Kohlmeyer e-mail: axel.kohlmeyer at rub.de
Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045
D-44780 Bochum http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================
More information about the CPMD-list
mailing list