#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) -----------------------------------+---------------------------------------- Reporter: knarf | Owner: Type: defect | Status: new Priority: major | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Keywords: | -----------------------------------+---------------------------------------- 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
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: review Priority: major | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+--------------------------------------- Changes (by knarf):
* status: new => review
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: reviewed_ok Priority: major | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+--------------------------------------- Changes (by eschnett):
* status: review => reviewed_ok
Comment:
Seems correct. Obviously a good idea. Please apply.
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: closed Priority: major | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: fixed | Keywords: ------------------------------------+--------------------------------------- Changes (by knarf):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Applied in r21
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: reopened Priority: major | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+--------------------------------------- Changes (by eschnett):
* status: closed => reopened * resolution: fixed =>
Comment:
I just realise that this auto-detection will be executed for all MPI implementations, not just for OpenMPI. These may not support these command line options, although an executable mpic++ will exist. Therefore, instead of checking whether mpic++ is executable, we need to check the return code of calling mpic++ with these options, and/or check whether the result is empty or an error message.
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: review Priority: critical | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+--------------------------------------- Changes (by knarf):
* priority: major => critical * status: reopened => review
Comment:
Right. What about the attached patch?
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: review Priority: critical | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+---------------------------------------
Comment (by eschnett):
The redirection should be {{{
/dev/null 2>&1
}}} because otherwise stderr will go to a copy of stdout, which will not be redirected. Try {{{ cc 2>&1 >/dev/null }}} to see the effect.
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: review Priority: critical | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+---------------------------------------
Comment (by knarf):
Right. Didn't even know that yet - thanks! Patch is updated.
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: reviewed_ok Priority: critical | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: | Keywords: ------------------------------------+--------------------------------------- Changes (by eschnett):
* status: review => reviewed_ok
#1308: MPI: use library list provided by mpic++ instead of guessing (wrong) ------------------------------------+--------------------------------------- Reporter: knarf | Owner: Type: defect | Status: closed Priority: critical | Milestone: ET_2013_05 Component: EinsteinToolkit thorn | Version: development version Resolution: fixed | Keywords: ------------------------------------+--------------------------------------- Changes (by knarf):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Fixed in r22 and thanks for the review.
trac@lists.einsteintoolkit.org