OpenMPI mpirun universe size

2019-07-20 19:53发布

问题:

I do not know if I perhaps understand this incorrectly. But here is what I want to achieve with OpenMPI in particular just starting with mpirun:

  • I want to create a single process using the -np parameter that specifies the world size as 1
  • I then want to set the universe size to some arbitrary number (for argument sake 10), how do I do this?

The following two commands:

  • MPI_Comm_size(MPI_COMM_WORLD, &world_size);
  • MPI_Attr_get(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, &universe_size, &flag);

yield the output of world_size as 1 and universe_size as 1.

回答1:

Ok, so I found 2 ways of doing this:

  • Implicit: mpirun -np 1 -H localhost,localhost,...,localhost executable
  • Explicit: just assign a value to universe_size in the application itself, it will work fine.

Thank you for anyone that looked at this.



标签: openmpi