| Home | Libraries | People | FAQ | More

## Function broadcast

boost::mpi::broadcast — Broadcast a value from a root process to all other processes.

## Synopsis

    // In header: <boost/mpi/collectives.hpp>

    template<typename T>
      void broadcast(const communicator & comm, T & value, int root);
    template<typename T>
      void broadcast(const communicator & comm, T * values, int n, int root);
    template<typename T>
      void broadcast(const communicator & comm, skeleton_proxy< T > & value,
                     int root);
    template<typename T>
      void broadcast(const communicator & comm, const skeleton_proxy< T > & value,
                     int root);

## Description

`broadcast` is a collective algorithm that transfers a value from an arbitrary `root` process to every other process that is part of the given communicator. The `broadcast` algorithm can transmit any Serializable value, values that have associated MPI data types, packed archives, skeletons, and the content of skeletons; see the `send` primitive for communicators for a complete list. The type `T` shall be the same for all processes that are a part of the communicator `comm`, unless packed archives are being transferred: with packed archives, the root sends a `packed_oarchive` or `packed_skeleton_oarchive` whereas the other processes receive a `packed_iarchive` or `packed_skeleton_iarchve`, respectively.

When the type `T` has an associated MPI data type, this routine invokes `MPI_Bcast` to perform the broadcast.

Parameters: |
`comm` | The communicator over which the broadcast will occur.
`root` | The rank/process ID of the process that will be transmitting the value.
`value` | The value (or values, if `n` is provided) to be transmitted (if the rank of `comm` is equal to `root`) or received (if the rank of `comm` is not equal to `root`). When the `value` is a `skeleton_proxy`, only the skeleton of the object will be broadcast. In this case, the `root` will build a skeleton from the object help in the proxy and all of the non-roots will reshape the objects held in their proxies based on the skeleton sent from the root.