Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] random MPI_UNIVERSE_SIZE and inter-commicator created by MPI_Comm_spawn
From: Mathieu Gontier (mg.mailing-list_at_[hidden])
Date: 2010-02-18 10:18:52


Another question on the same example.

When I ask the size on the inter-communitator (MPI_COMM_UNIVERSE in the
example) between the spaner/parent and the spawned/children processes,
the same number of processes than in MPI_COMM_WORLD is returned. I do
not really understand because I expected my MPI_COMM_UNIVERSE be a
higher communicator including here the group of MPI_COMM_SELF and the
group of MPI_COMM_WORLD of my spawned application (./worker).
I think I missed something. Does someone can help me?

Thank you.

Mathieu Gontier wrote:
>
>
> Hello,
>
> I am trying to use MPI_Comm_spawn (MPI-2 standard only) and I have an
> problem when I use MPI_UNIVERSE_SIZE. Here my code:
>
> int main( int argc, char *argv[] )
> {
> int wsize=0, wrank=-1 ;
> int usize=0, urank=-1 ;
> int ier ;
> int usize_attr=0, flag=0 ;
> MPI_Comm MPI_COMM_UNIVERSE;
> ier = MPI_Init( &argc, &argv ) ;
> ier = MPI_Comm_size( MPI_COMM_WORLD, &wsize ) ;
> ier = MPI_Comm_rank( MPI_COMM_WORLD, &wrank ) ;
> ier = MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, (void*)
> &usize_attr, &flag ) ;
> if ( !flag ) { printf( "[manager][error] This MPI does not support
> MPI_UNIVERSE_SIZE.\n" ) ; return 1 ; }
> if( wrank==0 ) {
> ier = MPI_Comm_spawn( "./worker", argv, ( wsize/2 > 2 ? wsize/2
> : 2 ), MPI_INFO_NULL, 0, MPI_COMM_SELF, &MPI_COMM_UNIVERSE,
> MPI_ERRCODES_IGNORE);
> ier = MPI_Comm_size( MPI_COMM_UNIVERSE, &usize ) ;
> ier = MPI_Comm_rank( MPI_COMM_UNIVERSE, &urank ) ;
> }
> printf( "[manager] I am the process %d on %d in world (universe attr
> size: %d) and %d on %d in universe\n", wrank, wsize, usize_attr,
> urank, usize ) ;
> MPI_Finalize();
> return 0;
> }
>
> When I call MPI_Comm_get_attr() with MPI_UNIVERSE_SIZE, my variable
> u_size_attr is random. Any idea?
>
> Thank you.
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>