[CMake] Use of mpi compiler / FINDMPI.cmake
Olivier Pierard
olivier.pierard at cenaero.be
Tue Dec 8 06:09:44 EST 2009
Dear all,
I'm a little bit confused with the use of findmpi.cmake. Does anyone
has an example of its usage (for compilation, not yet for running) ?
Since we have two mpi implementations (mpich and openmpi-ib), I set the
compiler as indicated in the preamble of the module and the library to
not found:
set(MPI_COMPILER ${MPI_ROOT}/bin/mpicxx)
set(MPI_LIBRARY MPI_LIBRARY-NOTFOUND)
find_package(MPI)
Cache variables are well set for MPI but not for MPIEXEC (but I don't
care for the moment, it's in a non-standard location):
MPIEXEC MPIEXEC-NOTFOUND
MPIEXEC_MAX_NUMPROCS 2
MPIEXEC_NUMPROC_FLAG -np
MPIEXEC_POSTFLAGS
MPIEXEC_PREFLAGS
MPI_COMPILE_FLAGS
MPI_EXTRA_LIBRARY
/softs/openmpi-ib/1.2.8-1/64/gcc/4.1.2/lib64/libmpi.so;/softs/openmpi
MPI_INCLUDE_PATH
/softs/openmpi-ib/1.2.8-1/64/gcc/4.1.2/include
MPI_LIBRARY
/softs/openmpi-ib/1.2.8-1/64/gcc/4.1.2/lib64/libmpi_cxx.so
MPI_LINK_FLAGS -Wl,-rpath
-Wl,/softs/openmpi-ib/1.2.8-1/64/gcc/4.1.2/lib64 -Wl,--exp
Now, what do I have to do with these variables ?
More precisely, how can I force the use of the MPI_COMPILER ? Do I have
to set the CMAKE_CXX_COMPILER to MPI_COMPILER value ? If yes, how can I
force it because it is initially set to /usr/bin/c++ (I've a cache
option to switch on/off sequential/parallel mode) and it seems
impossible to modify CMAKE_CXX_COMPILER once the variable is set (by the
way, when is it exectly initialized, with enable_language ?). If that's
the way, I imagine I've to append MPI_LIBRARY, MPI_COMPILE_FLAGS,
MPI_LINK_FLAGS,... to default flags, include dirs,...
Thank you very much for your help,
--
Olivier Pierard
CENAERO, Virtual Manufacturing Group
Bâtiment EOLE, 1er étage
Rue des Frères Wright, 29
B-6041 Gosselies
BELGIUM
Tel: +32.(0)71.919374
Fax: +32.(0)71.919370
http://www.cenaero.be/
+-+-+- Disclaimer +-+-+-
http://www.cenaero.be/disclaimer
More information about the CMake
mailing list