LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2003-04-07 21:11:08


On Sat, 5 Apr 2003 seberino_at_[hidden] wrote:

> I think mpi_comm_world argument may allow me to do something I very much
> need to do. Please help with some newbie questions about this argument
> if you don't mind....

Not quite sure what argument you're talking about: do you mean the
MPI_Comm argument to many of the MPI function calls?

MPI_COMM_WORLD is an instance of an MPI_Comm -- MPI_COMM_WORLD is a
constant, MPI_Comm is a type.

> * Is it possible to define lots of groups/communicators of nodes with 4
> nodes each and then refer to nodes in *different* groups as nodes
> 0,1,2,3???
>
> i.e. Can there be lots of node 0's in lots of different groups??? lots
> of node 1's??.. etc.

I'm not quite sure what you're asking. You can have as many groups and/or
communicators as you want. Each one of them will have a rank 0, which may
or may not be the same MPI process as other rank 0's.

Remember: most people use the work "rank" where they should really use the
word "process" (in an MPI context). For example, if you:

        mpirun -np 4 foo

You have 4 MPI processes. Each of them have a unique rank in
MPI_COMM_WORLD. But if you did:

        MPI_Comm_size(MPI_COMM_SIZE, &size);
        MPI_Comm_rank(MPI_COMM_SIZE, &rank);
        MPI_Comm_split(MPI_COMM_WORLD, 0, size - rank, &newcomm);

then each process will have a different rank in newcomm than they have in
MPI_COMM_WORLD. So every MPI process may have a different rank in every
communicator that it is in.

> * How do I define a new group/communicator and can I make the names be
> in an array???
>
> i.e. replace mpi_comm_world with my_mpi_comm_group(1)
> my_mpi_comm_group(2)
> my_mpi_comm_group(3), ... etc.

Per your other mail, I think you're confusing groups and communicators.

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/