You can't use gather either. Same for gatherv, as you need to know the amount you will receive in advance.
If I understand correctly your scenario (a random process is doing a broadcast at random time steps), using MPI collectives is not the best approach as they need global knowledge (there is a broadcast with a known root). Even if you implement your own protocol to broadcast the root of the next operation, without an agreement protocol this might lead to unmatched collectives. The most straightforward way to reach an agreement with MPI today is by focusing all broadcast decisions through a single process (a leader), who will decide in which order to available broadcast operations will be executed.
Oops,I think I meant gather not scatter...
users mailing list