Mathieu, Your MPI_COMM_UNIVERSE is a inter-communicator, and therefore the MPI_Comm_size and MPI_Comm_rank return the size, respectively the rank, in the local group. There is a special accessor for getting the remote group size (MPI_Comm_remote_size).
Now regarding the previous question (about the attribute MPI_UNIVERSE_SIZE), your answer is in the MPI standard 2.2 page 346 line 35. The MPI_UNIVERSE_SIZE is not set in Open MPI. george. On Feb 18, 2010, at 10:18 , Mathieu Gontier wrote: > > 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 >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users >> > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users