I'm a beginner to MPI. When I coded my first program, I came into a tough problem to me.
MPI_Init(&argc, &argv) ;
MPI_Comm_rank( MPI_COMM_WORLD, &rank) ;
MPI_Comm_size( MPI_COMM_WORLD, &size) ;
printf("Process: %d\n", rank);
printf("Procs_num: %d\n", size);
and:
mpicc main.c -o main
mpirun -np 8 main
But all I get is 8 duplicates of:
Process: 0
Procs_num: 1
What I expect to get is:
Process: 0~7
Procs_num: 8
I guess it is because there is no 8 processes in MPI_COMM_WORLD, but I cannot figure out the reason and have no idea about how to solve it.
And I hope you will catch what I want to express. Many thx!!