mpiprocessors

Wrong mpi number of processors


Sorry, I'm sure making a silly mistake, but did not work out.

I'm compiling a simple mpi hello world:

#include <stdio.h>
#include <mpi.h>

int main (argc, argv)
     int argc;
     char *argv[];
{
  int rank, size;

  MPI_Init (&argc, &argv);      /* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
  printf( "Hello world from process %d of %d\n", rank, size );
  MPI_Finalize();
  return 0;
}

And:

> mpicc -o hello_world_c hello_world.c
> mpirun -np 4 hello_world_c

But returns:

Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1

But my computer is a core i7 with 4 cores. And everything seems to be ok, ie. cat /proc/cpuinfo shows the 4 processors

what's happening??? Thanks in advance!!!!


Solution

  • There is nothing wrong with your code. The only problem that can be is with your mpi installation.

    Notice:

    There is a differences between processor to core. its not the same thing.