|
Boost Users : |
Subject: Re: [Boost-users] [mpi] - how to split communicator correctly?
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-11-12 08:12:54
On Thu, 12 Nov 2009, tomasz jankowski wrote:
> ello group,
>
> i think I know how to split communicators & how it works in pure c mpi.
> but I have problems with boost::mpi.
>
> assume that we want divide world communicator into 3 groups.
> please look here:
>
> mpi::environment env(argc, argv);
> mpi::communicator world;
> mpi::communicator elloa;
> mpi::communicator elloc;
> mpi::communicator ellob;
>
> if(world.rank() == 0){ elloa = world.split(0); }
> if(world.rank() == 1){ elloa = world.split(0); }
> if(world.rank() == 2){ elloa = world.split(0); }
> if(world.rank() == 3){ ellob = world.split(1); }
> if(world.rank() == 4){ ellob = world.split(1); }
> if(world.rank() == 5){ ellob = world.split(1); }
> if(world.rank() == 6){ elloc = world.split(2); }
> if(world.rank() == 7){ elloc = world.split(2); }
>
> if(world.rank() == 0){
> std::cout<<"elloa " << elloa.size()<<std::endl;
> std::cout<<"ellob " << ellob.size()<<std::endl;
> std::cout<<"elloc " << elloc.size()<<std::endl;
> }
>
> the code above gives me such results:
>
> elloa 3
> ellob 8
> elloc 8
>
> my question is why ellob and alloc communicators counts 8 members not 3
> and 2 respetively?
>
> what I'm doing incorrect?
Does similar code work in C? MPI_Comm_split must be called on all ranks
in the input communicator, not just those that will be in some particular
output communicator. See the top of
http://www.mpi-forum.org/docs/mpi22-report/node134.htm for this
restriction; the documentation for MPI_Comm_split is later on that page.
-- Jeremiah Willcock
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net