windows mpi - only one processor works?
-
Tuesday, January 26, 2010 6:08 PMI 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?
All Replies
-
Tuesday, January 26, 2010 9:33 PMHi,
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 11:31 PMLiwei,
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 -
Wednesday, January 27, 2010 2:46 AM
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- Marked As Answer by Don PatteeModerator Friday, January 29, 2010 7:36 AM
-
Wednesday, January 27, 2010 3:50 PM
Liwei,
Good idea. Thanks for your help!
rs- Proposed As Answer by SweperGroup Friday, February 19, 2010 9:20 PM
-
Friday, February 19, 2010 9:23 PM
Liwei,
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
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 -
Thursday, April 15, 2010 8:09 AM
Maybe your run command is not correct!
-
Tuesday, August 31, 2010 10:32 PMDon'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.