MantisBT - CMake
View Issue Details
0014347CMakeModulespublic2013-08-09 10:372015-01-05 08:39
Marcel Loose 
Brad King 
normalminoralways
closedfixed 
LinuxUbuntu13.04
CMake 2.8.11.2 
CMake 3.1CMake 3.1 
0014347: FindMPI sets MPIEXEC to wrong executable
When MPI is installed in a non-standard location (which is the rule, rather than the exception on cluster systems), FindMPI will not find the correct mpiexec.

Though you can help FindMPI to find the correct compilers, by setting MPI_<lang>_COMPILER variables, there's no way to do this for MPIEXEC.

1. Have MPI installed in a non-standard directory, e.g., /opt/openmpi
2. Create a CMakeLists.txt file that contains a line "find_package(MPI)"
3. Check the cache for the value of the different MPI variables
I think that the CMake|environment variable MPI_HOME should be used as HINTS in the call of find_program for mpiexec. Subsequently, _MPI_BASE_DIR (as derived from the path to mpiexec) can be used as HINTS in the call of find_program of the MPI compiler(s).

I've attached a patch that solves this problem.
No tags attached.
patch FindMPI.patch (829) 2013-08-09 10:37
https://public.kitware.com/Bug/file/4845/FindMPI.patch
Issue History
2013-08-09 10:37Marcel LooseNew Issue
2013-08-09 10:37Marcel LooseFile Added: FindMPI.patch
2013-08-09 10:38Marcel LooseSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=1233#r1233
2014-08-05 17:27Ryo IGARASHINote Added: 0036558
2014-08-11 11:11Brad KingNote Added: 0036593
2014-08-11 11:40Marcel LooseNote Added: 0036594
2014-08-11 11:52Brad KingNote Added: 0036595
2014-08-11 11:52Brad KingTarget Version => CMake 3.1
2014-08-11 13:08Brad KingNote Added: 0036598
2014-08-11 13:08Brad KingAssigned To => Brad King
2014-08-11 13:08Brad KingStatusnew => assigned
2014-08-12 04:04Marcel LooseNote Added: 0036600
2014-08-12 09:33Brad KingNote Added: 0036602
2014-08-12 14:06Brad KingNote Added: 0036605
2014-08-18 11:13Brad KingStatusassigned => resolved
2014-08-18 11:13Brad KingResolutionopen => fixed
2014-08-18 11:13Brad KingFixed in Version => CMake 3.1
2015-01-05 08:39Robert MaynardNote Added: 0037614
2015-01-05 08:39Robert MaynardStatusresolved => closed

Notes
(0036558)
Ryo IGARASHI   
2014-08-05 17:27   
I have been suffering from this issue, too.

On Fujitsu K computer or FX10 system, we cross-compile our application on the
front end(x86_64) for the SPARC(s64fx) back end.
MPI environment (mpirun/mpiexec) only works on the back end, therefore,
executing mpiexec on the front end (where we execute cmake command) always fails
and MPIEXEC is set to MPIEXEC-NOTFOUND.

As a workaround, I am forced to create a symlink of working mpiexec to
~/bin/MPIEXEC-NOTFOUND where I always add ~/bin to my PATH, which I believe
is very ugly.

I want MPIEXEC to be able to set manually such as CMAKE_COMMAND or CMAKE_CTEST_COMMAND variable.
(0036593)
Brad King   
2014-08-11 11:11   
The CMAKE_PREFIX_PATH variable may be set to a ;-separated list containing any local custom installation prefixes. They will be used by all find modules including FindMPI. This avoids the need for a per-package _HOME or _ROOT variable, which is why so few find modules provide them.
(0036594)
Marcel Loose   
2014-08-11 11:40   
Ryo, have you tried the patch I uploaded? If that works for you, then maybe it can be applied to FindMPI.cmake in the repo.
(0036595)
Brad King   
2014-08-11 11:52   
I just noticed that the attached FindMPI.patch simply extends existing use of MPI_HOME to work for MPIEXEC too rather than adding a new one. My advice in 0014347:0036593 can serve as a workaround but the patch is still worth testing too.
(0036598)
Brad King   
2014-08-11 13:08   
I've applied the patch (with minor tweaks) for testing:

 FindMPI: Honor MPI_HOME for MPIEXEC
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=150c2125 [^]

Please try it out.
(0036600)
Marcel Loose   
2014-08-12 04:04   
Brad, I saw you removed the quotes around the variable names in the applied patch. Out of curiosity, shouldn't I use quotes? I thought you need them to properly handle file paths containing spaces.
(0036602)
Brad King   
2014-08-12 09:33   
Re 0014347:0036600: I wanted to match the style in the rest of the module. Also if the values are empty then leaving out the quotes causes the argument to be removed rather than an empty string used.
(0036605)
Brad King   
2014-08-12 14:06   
Re 0014347:0036600: Oops, I left the last part of your question unanswered. Quotes in the CMake language are needed to prevent expansion of arguments by dividing on semicolons. Spaces make no difference.

See the cmake-language(7) manual for more information:

 http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#command-arguments [^]

Meanwhile, please let me know if the patch linked in 0014347:0036598 works for you.
(0037614)
Robert Maynard   
2015-01-05 08:39   
Closing resolved issues that have not been updated in more than 4 months