Hi,
I am trying to compile an OpenACC code on a cluster. On this cluster, the GCC compilers is not installed in the default location. More specifically:
[mboisson@helios1 cpp]$ which g++
/software6/compilers/gcc/4.8/bin/g++
[mboisson@helios1 cpp]$ find ${LIBRARY_PATH//:/ } -name ‘libstdc++.so’
find: “/software-gpu/compilers/pgi/15.10/linux86-64/15.10/libso”: Aucun fichier ou dossier de ce type
/software6/compilers/gcc/4.8/lib64/libstdc++.so
/software6/compilers/gcc/4.8/lib/libstdc++.so
/software6/compilers/gcc/4.6/lib64/libstdc++.so
/software6/compilers/gcc/4.6/lib/libstdc++.so
So, the libstdc++.so is within the LIBRARY_PATH.
Yet, when I compile the code, I get the following:
pgc++ main.o -o cg.x -fast
/software6/apps/buildtools/20150928/bin/ld: ne peut trouver -lstdc++
Makefile:6 : la recette pour la cible « cg.x » a échouée
The linker cannot find the stdc++ library.
Yet, if I compile it with g++ in the same environment, the linker has no trouble finding the stdc++ library:
My guess is the default g++ in your $PATH is not the same as the
g++ which the PGI compilers were installed under.
pgc++ -dryrun x.C
and see which version of gcc/g++ libs and headers pgc++ is using.
If they are different, either change your path, or reinstall the compilers
under the gcc/g++ compiler in your PATH.
Very difficult to run dynamically linked executables on systems where the
gcc/g++ shared libs are not present.
Typically, link with
-Bstatic_pgi
so that only the gcc/g++/system libs are dynamically linked, where they
are present.
btw - the definition of ‘cluster’ means all the nodes are running
the same Linux version and gcc/g++ versions. Having a heterogenous
collection of platforms, and calling it a cluster, can lead to problems.
But it also might work.
Very difficult to run dynamically linked executables on systems where the
gcc/g++ shared libs are not present.
But they ARE present. PG simply does not find them for some reason. Other compilers work just fine.
btw - the definition of ‘cluster’ means all the nodes are running
the same Linux version and gcc/g++ versions. Having a heterogenous
collection of platforms, and calling it a cluster, can lead to problems.
But it also might work.
Indeed, and this is the case. Why you imply that it is not the case here ?
If you look at the output of an executable with ldd
ldd foo
on your build machine, you should see where it finds the
gcc libraries. If the slave nodes are the same OS and gcc versions,
ldd foo
on each of the slave nodes should indicate the same locations
for gcc libs. If the gcc libs are on the slave nodes but in different places, how
can this be? - it’s a cluster, and everything is the same!
Any paths that are different on the slave nodes, should be added
to $LD_LIBRARY_PATH.