[CMake] Rv: How to compile MPI code

Mª Dolores Villalobos Ortiz lolalobos17 at yahoo.es
Wed Jun 22 13:45:15 EDT 2011


I use (or try to use) mpicxx. There is an older post in http://www.mail-archive.com/cmake@cmake.org/msg36851.html

--------------------------------------------------------------------------

Hm... this is the CMake user list, not the MPI-user list..... You're
posing your question on the wrong list.
(but.... how did you compile? Did you use mpicc?)

Sincerely,
Jakob

On 06/22/2011 02:25 PM, M? Dolores Villalobos Ortiz wrote:
>  >What do you mean with "it doesn't run correctly"? Does it not even
> start? How do you start your program?
>
> ------------------------------------------------------
>
> My program's code is:
>
> #include <iostream>
> using namespace std;
> #include "mpi.h"
>
> int main( int argc, char * argv[] )
> {
>
> int node;
> int num_nodes;
> int i, buf;
>
> MPI::Init(argc, argv);
> node = MPI::COMM_WORLD.Get_rank();
> num_nodes = MPI::COMM_WORLD.Get_size();
>
> std::cout << "I am node " << node << std::endl;
>
> if ( node == 0 ) {
> std::cout << "I am node " << node << std::endl;
> std::cout << "Num threads (Get_size) -> " << num_nodes << std::endl;
> }
> else
> {
> std::cout << "I am node " << node << std::endl;
> }
> MPI_Finalize();
> return 0;
> }
> ------------------------------------------------------
>
> And, in order to run the program, I type in Ubuntu's terminal:
>
> mpiexec -n 2 ./main_program
>
> -------------------------------------------------------------
>
> The program write in terminal:
>
> I am node 0
> I am node 0
> Num threads (Get_size) -> 1
> I am node 0
> I am node 0
> Num threads (Get_size) -> 1
>
> instead of:
>
> I am node 0
> I am node 0
> Num threads (Get_size) -> 2
> I am node 1
> I am node 1
>
>
> Lola

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110622/14b26dfe/attachment.htm>


More information about the CMake mailing list