none
windows mpi - only one processor works? RRS feed

  • Question

  • I am learning mpi I installed MPICH2 and Dev-C++ on a core 2 duo pentium winxp). When running hello world, there was only one output Hello world from process 0 of 1" Any problem? Thanks! Here is the code:

     #include <stdio.h>

    #include "mpi.h"

     

    int main( argc, argv )

    int  argc;

    char **argv;

    {

        int rank, size;

        MPI_Init( &argc, &argv );

        MPI_Comm_size( MPI_COMM_WORLD, &size );

        MPI_Comm_rank( MPI_COMM_WORLD, &rank );

         printf( "Hello world from process %d of %d\n", rank, size );

        MPI_Finalize();

      system("PAUSE");        

      return 0;

    }

    • Edited by runsun Tuesday, January 26, 2010 6:10 PM extra code from server?
    Tuesday, January 26, 2010 6:08 PM

Answers

  • Hi Runsun,

    I am not familiar with Dev-C++ so not sure how to configure it efficiently with MPI.

    One suggestion that may help: create a sample .dev file that has MPI configured ( Includes, Libs, and Linker). when creating a new project, always copy this sample .dev file then modify it a little bit.

    hope it helps

    liwei
    Wednesday, January 27, 2010 2:46 AM

All replies

  • Hi,

    1) can you provide details on how you ran the MPI program?

    To use multiple processes (e.g. 8), a typical cmdline looks like below:
     > mpiexec -n 8 TEST.exe

    2) Are you using MSMPI or MPICH2 from ANL? The way to run MPI are a little bit different between these two.

    thanks,

    Liwei
    Tuesday, January 26, 2010 9:33 PM
  • Liwei,
    Thank you for your response.
    It seems that I've found where the problem was.
    1) I compiled and ran the program in Dev-C++ directly. It gave the result (only one process) as I described in the 1st post.
        When I ran in MPIEXE and set n of processes = 2, it worked OK.

    2) I use MPICH2.


    Now I have another question:
    Whenever I create a new project in Dev-C++, I have to change the .dev file again (add Includes, Libs, and Linker) for mpi. Is there an efficient way to do that?
    Thanks again.


    rs
    Tuesday, January 26, 2010 11:31 PM
  • Hi Runsun,

    I am not familiar with Dev-C++ so not sure how to configure it efficiently with MPI.

    One suggestion that may help: create a sample .dev file that has MPI configured ( Includes, Libs, and Linker). when creating a new project, always copy this sample .dev file then modify it a little bit.

    hope it helps

    liwei
    Wednesday, January 27, 2010 2:46 AM
  • Liwei,
    Good idea. Thanks for your help!

    rs
    • Proposed as answer by SweperGroup Friday, February 19, 2010 9:20 PM
    Wednesday, January 27, 2010 3:50 PM
  • Liwei,
    Thank you for your response.
    It seems that I've found where the problem was.
    1) I compiled and ran the program in Dev-C++ directly. It gave the result (only one process) as I described in the 1st post.
        When I ran in MPIEXE and set n of processes = 2, it worked OK.

    2) I use MPICH2.


    Now I have another question:
    Whenever I create a new project in Dev-C++, I have to change the .dev file again (add Includes, Libs, and Linker) for mpi. Is there an efficient way to do that?
    Thanks again.


    rs
    Hi runsun, I have tried to run the parallel code as you wrote but I keep getting an error like: "Credentials for gerko rejected connecting to gerko Aborting: Unable to connect to gerko" what might be my problem? Thanks
    Friday, February 19, 2010 9:23 PM
  • Maybe your run command is not correct!

    Thursday, April 15, 2010 8:09 AM
  • Don't forget to run the process as an Administrator. In other forum I found a suggestion, create a shortcut for cmd and after create ir us it with right click and then run it as an Administrator if you are using Vista or Win7. I hope it helps.
    Tuesday, August 31, 2010 10:32 PM