diff options
author | knarf <knarf@043a8217-7a68-40fe-abfd-36aa7d4fa6a8> | 2013-04-07 04:11:45 +0000 |
---|---|---|
committer | knarf <knarf@043a8217-7a68-40fe-abfd-36aa7d4fa6a8> | 2013-04-07 04:11:45 +0000 |
commit | 8ebb7769773dc9b77984ac82c11b302ee981d4bd (patch) | |
tree | a1c1e57d79be23f1a0e527177e0e6fb318ca9368 | |
parent | a8573f077994dd86418fb9b1db996200422c9199 (diff) |
At the moment, ExternalLibraries/MPI guesses that the library list for
openmpi is just 'mpi mpi_cxx'. This is wrong in my case (even for the
built library; I need additional libraries. The OpenMPI FAQ mentions this:
"NOTE: It is absolutely not sufficient to simply add "-lmpi" to your link
line and assume that you will obtain a valid Open MPI executable."
They do recommend to use the compiler wrappers. I didn't try that, leaving
a patch to a minimum. I would also not be sure how to replace to actual
compilers using a thorn while it is supposedly being compiled - after the
Cactus configure state (cannot do it before since the wrappers might not
be build yet). Thus, I go the second way - also shown in the FAQ: I use
mpic++ to get hold of the flags that are needed when linking against the
library. This is very similar to what happens for some of the other
ExternalLibraries as well (but a bit simpler since they also provide
options to just get a list of the libraries, not including the flags
themselves - which is what Cactus expects).
In my case, this uses the libraries 'mpi_cxx mpi nsl util m m nsl util m
dl openmp'. Especially the missing 'util' in the current list prevented me
from linking. Adding it hard to the list however might be wrong on systems
where this is not needed or that library might not even exist. (and this
isn't the only missing library)
I would like this to be included in the next release, as this would
otherwise prevent people from building on at least some of the major Linux
distros out of the box (Debian wheezy here) - or we would have to specify
the library list by hand for these systems. Given the central part MPI
plays I set this to 'major'. If we see problems with this approach we can
still guess the missing libraries and try that, until after the release.
OpenMPI FAQ: http://www.open-mpi.org/faq/?category=mpi-apps
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/MPI/trunk@21 043a8217-7a68-40fe-abfd-36aa7d4fa6a8
-rwxr-xr-x | configure.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.sh b/configure.sh index f5b8453..5ade474 100755 --- a/configure.sh +++ b/configure.sh @@ -192,6 +192,13 @@ fi # Set options +# use mpic++ if available +if [ -x ${MPI_DIR}/bin/mpic++ ]; then + : ${MPI_LIBS="$(echo '' $(${MPI_DIR}/bin/mpic++ --showme:libs) '')"} + : ${MPI_LIB_DIRS="$(echo '' $(${MPI_DIR}/bin/mpic++ --showme:libdirs) '' | sed -e 's+\( \|^\)/lib\( \|$\)++g;s+\( \|^\)/lib64\( \|$\)++g;s+\( \|^\)/usr/lib\( \|$\)++g;s+\( \|^\)/usr/lib64\( \|$\)++g;s+\( \|^\)/usr/local/lib\( \|$\)++g;s+\( \|^\)/usr/local/lib64\( \|$\)++g')"} + : ${MPI_INC_DIRS="$(echo '' $(${MPI_DIR}/bin/mpic++ --showme:incdirs) '' | sed -e 's+\( \|^\)/include\( \|$\)++g;s+\( \|^\)/use/include\( \|$\)++g;s+\( \|^\)/usr/local/include\( \|$\)++g')"} +fi + if [ "${MPI_DIR}" != '/usr' -a "${MPI_DIR}" != '/usr/local' ]; then : ${MPI_INC_DIRS="${MPI_DIR}/include"} : ${MPI_LIB_DIRS="${MPI_DIR}/lib"} |