c++ - How to broadcast or send a single value to multiple processes (but not all of them)? -
what i'm trying broadcast value (my pivot) sub domain of hypercube communicator. illustration process 0 sends process 1,2 & 3 when process 4 sends 4,5 & 6. require create communicators before hand or there way broadcast/send selected processes?
int broadcaster = 0; if(isbroadcaster) { cout << "rank " << mpirank << " currentd:" << currentd << " selecting pivot: " << pivot << endl; pivot = currentvalues[0]; broadcaster = mpirank; } //todo: broadcast processes 0 4 only. //here, mpi_comm_hypercube contains process 0 8 mpi_bcast(&pivot, 1, mpi_int, broadcaster, mpi_comm_hypercube);
the best solution utilize mpi_comm_split
break processes sub-communicators. is way of describing communication domains.
the mpi_group
object used describing groups, part can't used perform communication.
another alternative utilize mpi_alltoallv
. that's pretty nasty though, , lots of overkill.
c++ c mpi broadcast
No comments:
Post a Comment