On Jun 22, 2011, at 11:11 AM, Mª Dolores Villalobos Ortiz wrote:

> Thank you.
> 
> I have tried to compile my code using that version of CMakeLists, but it 
> doesn't work. My program's output is still wrong.

Whether or not mpiexec launches properly isn't something CMake can control.  If 
you are getting rank 0 for all your processes when you launch mpiexec, this is 
more than likely a problem with your system.

Just out of curiosity, what version of MPI are you using?  And does the code 
work when you compile it *without* CMake?  e.g. if you just run:

        mpicxx -o hello hello.cpp
        mpiexec -n 2 ./hello

Does that work, or does that do the same thing?

-Todd



> This is completely, utterly wrong!
> 
> 
> # 2.7 was a development version, so you should either specify
> # 2.6 or 2.8...
> cmake_minim_required(VERSION 2.7)
> project(ITK_MPI)
> 
> find_package(MPI REQUIRED)
> 
> include_directories(${MPI_INCLUDE_PATH})
> 
> add_executable(hello hello.cpp)
> target_link_libraries(hello ${MPI_LIBRARIES})
> 
> if(MPI_COMPILE_FLAGS)
>   set_target_properties(hello PROPERTIES
>     COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
> endif()
> 
> if(MPI_LINK_FLAGS)
>   set_target_properties(hello PROPERTIES
>     LINK_FLAGS "${MPI_LINK_FLAGS}")
> endif()
> 
> 
> You should *NEVER* set CMAKE_<LANG>_COMPILER, this completely breaks
> things. Also, with CMake you shouldn't use the compiler wrappers (mpicxx
> etc.), because CMake figures out how to compile MPI programs without it.
> 
> HTH
> 
> Michael
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

______________________________________________________________________
Todd Gamblin, tgamb...@llnl.gov, http://people.llnl.gov/gamblin2
CASC @ Lawrence Livermore National Laboratory, Livermore, CA, USA

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to