Hi all,
there's a problem with openMPI on my machine. When I simply try to run this little hello_world-program on multiple processors, the output isn't as expected:
*****
C code:
#include <mpi.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int size,rank;
char hostname[50];
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank); //Who am I?
MPI_Comm_size(MPI_COMM_WORLD, &size); //How many processes?
gethostname (hostname, 50);
printf ("Hello World! I'm number %2d of %2d running on host %s\n",
rank, size, hostname);
MPI_Finalize();
return 0;
}
****
Command: mpirun -np 4 a.out
Output:
Hello World! I'm number 0 of 1 running on host marvin
Hello World! I'm number 0 of 1 running on host marvin
Hello World! I'm number 0 of 1 running on host marvin
Hello World! I'm number 0 of 1 running on host marvin
It should be more or less:
Hello World! I'm number 1 of 4 running on host marvin
Hello World! I'm number 2 of 4 running on host marvin
....
OpenMPI-version 1.4.1 compiled with Lahey Fortran 95 (lf95).
OpenMPI was compiled "out of the box" only changing to the Lahey compiler with a setenv $FC lf95
The System: Linux marvin 2.6.27.6-1 #1 SMP Sat Nov 15 20:19:04 CET 2008 x86_64 GNU/Linux
Compiler: Lahey/Fujitsu Linux64 Fortran Compiler Release L8.10a
Thanks very much!
Klaus
|