Hello everybody,
I have just installed openmpi v. 1.2.5 under ubuntu 8.04 and I have compiled the following "hello world" program:
------start code------
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[]){
int rank, size, len;
char hostname[256] = "";
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Get_processor_name(hostname, &len);
printf("Hello World! I am %d of %d running on %s\n",
rank, size, hostname);
MPI_Finalize();
return 0;
}
------end code------
which I think is pretty basic stuff. Anyway, when I run it (single node, three cores), I get the following output:
mpiexec.openmpi -np 6 hello
Hello World! I am 0 of 1 running on el-torito
Hello World! I am 0 of 1 running on el-torito
Hello World! I am 0 of 1 running on el-torito
Hello World! I am 0 of 1 running on el-torito
Hello World! I am 0 of 1 running on el-torito
Hello World! I am 0 of 1 running on el-torito
where "el-torito" is the hostname. Shouldn't it be something like?:
Hello World! I am 0 of 6 running on el-torito
Hello World! I am 1 of 6 running on el-torito
Hello World! I am 2 of 6 running on el-torito
...
etc.
Any ideas as to why I keep getting wrong numbers for rank and number of processes?
Greetings from Monterrey, Mexico
--
Victor M. Rosas García