<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi<br><br>I'm trying to compile a main program (it contains MPI functions) using cmake. I get an executable file (there aren't problems in compilation ), but it doesn't run correctly.<br><br>If I compile my code using a simple Makefile, it works; but I need to compile it using cmake (that's a prerequisite for my work).<br><br>I have installed MPICH2 and cmake 2.8.4. and I use the next files:<br><br>CMakeLists.txt:<br><br>cmake_minimum_required(VERSION 2.7)<br>set(CMAKE_CXX_COMPILER "/home/lola/Packages/mpich2-1.3.2p1/bin/mpicxx")<br>set(CMAKE_C_COMPILER "/home/lola/Packages/mpich2-1.3.2p1/bin/mpicc")<br>project( ITK_MPI )<br>find_package ( MPI )<br>if ( MPI_FOUND )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; include_directories( ${MPI_INCLUDE_PATH} )<br>endif( MPI_FOUND
 )<br><br>------------------------------------------------------------------------------------------------------<br><br>CMakeCache.txt:<br><br>.....<br>......<br><br>//CXX compiler.<br>CMAKE_CXX_COMPILER:FILEPATH=/home/lola/Packages/mpich2-1.3.2p1/bin/mpicxx<br>//Flags used by the compiler during all build types.<br>CMAKE_CXX_FLAGS:STRING=<br>//Flags used by the compiler during debug builds.<br>CMAKE_CXX_FLAGS_DEBUG:STRING=<br>//Flags used by the compiler during release minsize builds.<br>CMAKE_CXX_FLAGS_MINSIZEREL:STRING=<br>//Flags used by the compiler during release builds (/MD /Ob1 /Oi<br>// /Ot /Oy /Gs will produce slightly less optimized but smaller<br>// files).<br>CMAKE_CXX_FLAGS_RELEASE:STRING=<br>//Flags used by the compiler during Release with Debug Info builds.<br>CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=<br>//C compiler.<br>CMAKE_C_COMPILER:FILEPATH=/home/lola/Packages/mpich2-1.3.2p1/bin/mpicc<br><br>....<br>....<br><br>//Value Computed by
 CMake<br>ITK_MPI_BINARY_DIR:STATIC=/home/lola/Curso/Proyecto/Pruebas_MPI<br>//Value Computed by CMake<br>ITK_MPI_SOURCE_DIR:STATIC=/home/lola/Curso/Proyecto/Pruebas_MPI<br>//Executable for running MPI programs.<br>MPIEXEC:FILEPATH=/home/lola/Packages/mpich2-1.3.2p1/bin/mpiexec<br>//Maximum number of processors available to run MPI applications.<br>MPIEXEC_MAX_NUMPROCS:STRING=2<br>//Flag used by MPI to specify the number of processes for MPIEXEC;<br>// the next option will be the number of processes.<br>MPIEXEC_NUMPROC_FLAG:STRING=-n2<br>//These flags will come after all flags given to MPIEXEC.<br>MPIEXEC_POSTFLAGS:STRING=<br>//These flags will be directly before the executable that is being<br>// run by MPIEXEC.<br>MPIEXEC_PREFLAGS:STRING=<br>//MPI compiler. Used only to detect MPI compilation flags.<br>MPI_COMPILER:FILEPATH=/home/lola/Packages/mpich2-1.3.2p1/bin/mpicxx<br>//MPI compilation flags<br>MPI_COMPILE_FLAGS:STRING=' '<br>//Extra MPI libraries
 to link against<br>MPI_EXTRA_LIBRARY:STRING=/usr/lib/mpich/lib/libmpich.a;/usr/lib/libpthread.so;/usr/lib/librt.so<br>//MPI include path<br>MPI_INCLUDE_PATH:STRING=/home/lola/Packages/mpich2-1.3.2p1/include<br>//MPI library to link against<br>MPI_LIBRARY:FILEPATH=/usr/lib/mpich/lib/libpmpich++.a;/usr/lib/mpich/lib/libmpich.a;/usr/lib/libpthread.so;/usr/lib/librt.so<br>//MPI linking flags<br>MPI_LINK_FLAGS:STRING=<br>.....<br>....<br><br>¿What's am I doing wrong?, ¿Is there any other configuration?. I really need to make it work.<br><br>Thank you<br><br>Lola<br></td></tr></table>