[CMake] New FindMPI implementation in next

Todd Gamblin tgamblin at llnl.gov
Fri Jan 14 14:47:52 EST 2011


All,

There is a new implementation of the FindMPI module in next.  There are a number of changes in this version, and it did not quite make it into 2.8.4 because it needs more testing.  If you are interested in this and can kick the tires, please try it out and send feedback to me.

There motivation for the new version was that the existing FindMPI does not support multiple languages properly.  It assumes you want either C++ or C, and it doesn't care which you get.  There is also no good way to do MPI for fortran -- the compilers are not detected.

The new interface replaces these variables:
	MPI_FOUND
	MPI_COMPILER
	MPI_LIBRARY
	MPI_COMPILE_FLAGS
	MPI_INCLUDE_PATH
	MPI_EXTRA_LIBRARY
	MPI_LINK_FLAGS
	MPI_LIBRARIES

With these:
	MPI_<lang>_FOUND           TRUE if FindMPI found MPI flags for <lang>
	MPI_<lang>_COMPILER        MPI Compiler wrapper for <lang>
	MPI_<lang>_COMPILE_FLAGS   Compilation flags for MPI programs
	MPI_<lang>_INCLUDE_PATH    Include path(s) for MPI header
	MPI_<lang>_LINK_FLAGS      Linking flags for MPI programs
	MPI_<lang>_LIBRARIES       All libraries to link MPI programs against
	
for each <lang> in (CXX, C, Fortran).

The old variables will continue to work; they are set to the MPI_CXX_ equivalent if it is available, and the MPI_C_ version if it is not.

However, there are some backward compatibility concerns.  In particular, you need to set either MPI_<lang>_COMPILER or MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES to override autodetection.  In the old FindMPI, you would have set either MPI_COMPILER,  MPI_INCLUDE_PATH, MPI_LIBRARY, and possibly MPI_EXTRA_LIBRARY to do the same.  Right now, the old variables don't serve as hints to the new detection mechanism, so you may need to reconfigure your -D arguments to CMake for new projects.

Again, the old variables continue to be *set* in the new version, but they are no longer used as input to the module.

Finally, there are a few other improvements.  This FindMPI will search for more compiler names, and it will attempt to match the MPI compiler to the ID of the CXX, C, or Fortran compiler.  This version also searches a few more paths for Windows, and should properly detect MPICH2 on Windows.

Please test this as much as possible so that hopefully this or some improved version can go into 2.8.5 in April.  You can either try the version in CMake next, or the attached FindMPI.cmake. 

-Todd



-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindMPI.cmake
Type: application/octet-stream
Size: 25110 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110114/b524b155/attachment-0001.obj>


More information about the CMake mailing list