Broadcast is a collective communication primitive in parallel programming to distribute programming instructions or data to nodes in a cluster. It is the reverse operation of reduction.[1] The broadcast operation is widely used in parallel algorithms, such as matrix-vector multiplication, Gaussian elimination and shortest paths.
The Message Passing Interface implements broadcast in MPI_Bcast
.[2]
A message
M[1..m]
m
p-1
Tbyte
Tstart
Therefore, the time to send a package from one node to another is
t=size x Tbyte+Tstart
p
With Binomial Tree Broadcast the whole message is sent at once. Each node that has already received the message sends it on further. This grows exponentially as each time step the amount of sending nodes is doubled. The algorithm is ideal for short messages but falls short with longer ones as during the time when the first transfer happens only one node is busy.
Sending a message to all nodes takes
log2(p)t
log2(p)(mTbyte+Tstart)
id := node numberp := number of nodes
if id > 0 blocking_receive Mfor (i := ceil(log_2(p)) - 1; i >= 0; i--) if (id % 2^(i+1)
The message is split up into
k
n
n+1
t
Sending a whole message takes
(p+k)\left(
mTbyte | |
k |
+Tstart\right)=(p+k)t=pt+kt
Optimal is to choose
k=\sqrt{
m(p-2)Tbyte | |
Tstart |
}
The run time is dependent on not only message length but also the number of processors that play roles. This approach shines when the length of the message is much larger than the amount of processors.
for (i := 1; i <= n; i++) in parallel if (id != 0) blocking_receive m_i if (id != n) send m_i to node id + 1
This algorithm combines Binomial Tree Broadcast and Linear Pipeline Broadcast, which makes the algorithm work well for both short and long messages. The aim is to have as many nodes work as possible while maintaining the ability to send short messages quickly. A good approach is to use Fibonacci trees for splitting up the tree, which are a good choice as a message cannot be sent to both children at the same time. This results in a binary tree structure.
We will assume in the following that communication is full-duplex. The Fibonacci tree structure has a depth of about
d ≈ log\Phi(p)
\Phi=
1+\sqrt{5 | |
The resulting runtime is . Optimal is
k=\sqrt{
n(d-2)Tbyte | |
3Tstart |
This results in a runtime of
2mTbyte+Tstartlog\Phi(p)+\sqrt{2mlog\Phi(p)TstartTbyte
for i = 1 to k if (hasParent) blocking_receive m_i if (hasChild(left_child)) send m_i to left_child if (hasChild(right_child)) send m_i to right_child
This algorithm aims to improve on some disadvantages of tree structure models with pipelines. Normally in tree structure models with pipelines (see above methods), leaves receive just their data and cannot contribute to send and spread data.
The algorithm concurrently uses two binary trees to communicate over. Those trees will be called tree A and B. Structurally in binary trees there are relatively more leave nodes than inner nodes. Basic Idea of this algorithm is to make a leaf node of tree A be an inner node of tree B. It has also the same technical function in opposite side from B to A tree. This means, two packets are sent and received by inner nodes and leaves in different steps.
The number of steps needed to construct two parallel-working binary trees is dependent on the amount of processors. Like with other structures one processor can is the root node who sends messages to two trees. It is not necessary to set a root node, because it is not hard to recognize that the direction of sending messages in binary tree is normally top to bottom. There is no limitation on the number of processors to build two binary trees. Let the height of the combined tree be . Tree A and B can have a height of
h-1
p=2h-1
To construct this model efficiently and easily with a fully built tree, we can use two methods called "Shifting" and "Mirroring" to get second tree. Let assume tree A is already modeled and tree B is supposed to be constructed based on tree A. We assume that we have
p
p-1
The "Shifting" method, first copies tree A and moves every node one position to the left to get tree B. The node, which will be located on -1, becomes a child of processor
p-2
"Mirroring" is ideal for an even number of processors. With this method tree B can be more easily constructed by tree A, because there are no structural transformations in order to create the new tree. In addition, a symmetric process makes this approach simple. This method can also handle an odd number of processors, in this case, we can set processor
p-1
We need to find a schedule in order to make sure that no processor has to send or receive two messages from two trees in a step. The edge, is a communication connection to connect two nodes, and can be labelled as either 0 or 1 to make sure that every processor can alternate between 0 and 1-labelled edges. The edges of and can be colored with two colors (0 and 1) such that
In every even step the edges with 0 are activated and edges with 1 are activated in every odd step.
In this case the number of packet k is divided in half for each tree. Both trees are working together the total number of packets
k=k/2+k/2
In each binary tree sending a message to another nodes takes
2i
i
d:=log2(p+1) ⇒ log2(p+1) ≈ log2(p)
This results in a run time of
T(m,p) ≈ mTbyte+Tstart ⋅ 2log2(p)+\sqrt{m ⋅ 2log2(p)TstartTbyte
In this section, another broadcasting algorithm with an underlying telephone communication model will be introduced. A Hypercube creates network system with
p=2d(d=0,1,2,3,...)
{0,1}
m
k
0d
k
p0
k
p0
d+k
m
The resulting run time is . .
This results in a run time of
T(m,p):=mTbyte+dTstart+\sqrt{mdTstartTbyte