Calculate the time of an all-to-all broadcast for a balanced binary tree (BBT)

In summary: T_8 = t_s + t_w * m * P/2##From the equation for calculating time of an exchange of two m-word messages b/w any two nodes connected by bidirectional channels, you can see that:k = 1##T = t_s + t_w * m *1##k = 2##T = t_s + t_w * m * 2##...k = 8##T = t_s + t_w * m * P/2##So, you are adding:logP(t_s + t_w * m (P/8 +
  • #1
zak100
462
11
Homework Statement
I am trying to calculate the time of all-to-all broadcast for balanced binary tree (BBT) but my equation is not correct. I need some help in correction of my equation
Relevant Equations
1) Required Time Equation = (t_s + t_w*m*p/2)logp

2)Time for an exchange of two m-word messages between any two nodes connected by bidirectional channels is:
t_s + t_w*m*k
if the communication channel (or a part of it) is shared by k simultaneous messages.
Hi,
I have provided a procedure for broadcast for BBT at the following link:

https://cs.stackexchange.com/questions/106631/all-to-all-broadcast-on-a-balanced-binary-tree

But I am not getting the correct time as asked in the question:

Required Timing equation is: ##(t_s + t_w * m* p/2)logp##

Where

##t_s## = start up time

##t_w## = per word transfer time

m = size of message

P = number of processors

Given equation for calculating time of an exchange of two m-word messages b/w any two nodes connected by bidirectional channels is:

##T = t_s + t_w*m *k##

Step1: k= 1

##T = t_s + t_w * m *1##

## T = t_s + t_w * m * P/8## //Note number of processors = 8

Step 2 : k =2

##T = t_s + t_w * m * 2##

## T = t_s + t_w * m * P/4##

Step 3: k =4

##T = t_s + t_w * m * 4##

## T = t_s + t_w * m * P/2##

Adding:## logP(t_s + t_w * m (P/8 + P/4 + P/2))##

Which is not equal to:
## logP(t_s + t_w * m * P/2)##

Can somebody please guide me what is my mistake?
Zulfi.
 
Physics news on Phys.org
  • #2
Zulfi, your solution on StackExchange doesn't make sense to me. Here's a drawing of a balanced binary tree with 6 nodes.
tree.png

If the binary tree is balanced, then every leaf node will be the same distance away from the root. In the solution you linked to, there are 8 nodes, numbered 0 through 7. If you want, you can imagine that the nodes in the figure above are numbered from 0 through 5. The tree in the drawing can have one more node and still be balanced, as the left subnode under 5 in the figure above, but where will the 8th node go? I don't see anywhere it can go and still leave you with a balanced binary tree. Maybe this is why you aren't getting the answer you think you should get.
 
  • Informative
Likes anorlunda
  • #3
Hi,
Thanks for your reply.

I don't have to create a balanced binary tree. I have provided a balanced binary such that:
P0 (i.e processor zero) contains message zero (i.e. M0), P1 conatins M1, P2 contains M2, P3 contains M3, P4 contains M4, P5 contains M5, P6 contains M6, and P7 contains M7.

However after all to all broadcast I would have such a situation that each processor has all the messages.
i.e P0 has messages M0, M1, M2, M3, M4, M5, M6, M7
P1 also has M0, M1, M3, M3, M4, M5, M6, M7 and so P2, P3, P4,...P7.

Now equation (1) above is used to calculate the timing for this 3 step communication. I would calculate the timing for each step and then sum them to calculate the overall timing. This overall timing should be same as equation (2).

3 steps means log base 2 of 8. There are 8 processors 0---7. So it requires 3 steps. Some how after the sum i.e equation (3), the 2nd term of equation (3), should produce 4 which is same as p/2 as in equation (2).

I have also provided the link of the question.

Zulfi.
 
  • #4
zak100 said:
I don't have to create a balanced binary tree. I have provided a balanced binary such that:
P0 (i.e processor zero) contains message zero (i.e. M0), P1 conatins M1, P2 contains M2, P3 contains M3, P4 contains M4, P5 contains M5, P6 contains M6, and P7 contains M7.
Yes, I understand all that, but what I'm saying is what does your balanced binary tree with 8 nodes look like? The tree in the drawing I provided has 6 nodes. The 3 leaf nodes are all two links away from the root. I can add one more leaf, and the tree will still be balanced, with all leaf nodes still two links away from the root, and it will have 7 nodes. How can you add one more node and keep the binary tree balanced?

Please draw such a tree for me.
 
  • #5
Hi,
Thanks for your reply.

I am uploading an image of a balanced binary tree which can be used for both for All-to-All broadcast and one
Balanced Binary tree for All-to_All BroadCast.jpg
-to-All broadcast. Note Fat binary tree is not required.

Thanks for your interest in my problem.

God bless you.
Zulfi.
 
  • #6
OK, I was under the impression that all nodes had to populated.
zak100 said:
Step1: k= 1
##T = t_s + t_w * m *1##

## T = t_s + t_w * m * P/8## //Note number of processors = 8
<snip - 2 more steps>
What does the value of k = 1 mean as far as the message exchanges are concerned?
Same question for the steps with k = 2 and k = 3.

zak100 said:
Adding:## logP(t_s + t_w * m (P/8 + P/4 + P/2))##
What are you adding to get the above?

From the work you showed before, you have:
k = 1
## T_1 = t_s + t_w * m * P/8##
k = 2
## T_2 = t_s + t_w * m * P/4##
k = 3
## T_3 = t_s + t_w * m * P/2##
(I added subscripts to these T values.)
How did you go from these three equations to something involving ##\log(P)##?
If you add ##T_1, T_2##, and ##T_3##, you get ##3t_s + t_w (P/8 + P/4 + P/2)##. Where does ##\log(P)## come from?
 

1. How is the time of an all-to-all broadcast calculated for a balanced binary tree?

The time of an all-to-all broadcast for a balanced binary tree can be calculated using the formula log2(n), where n is the number of nodes in the tree. This formula takes into account the number of levels in the tree and the number of nodes at each level.

2. What is a balanced binary tree?

A balanced binary tree is a tree data structure in which the difference in height between the left and right subtrees of any node is no greater than one. This ensures that the tree is evenly distributed and allows for efficient operations such as all-to-all broadcast.

3. How does the structure of a balanced binary tree affect the time of an all-to-all broadcast?

The balanced structure of a binary tree ensures that the number of levels in the tree is minimized, which in turn reduces the time for an all-to-all broadcast. This is because the number of nodes that need to be traversed is also minimized, resulting in a more efficient broadcast process.

4. What are the advantages of using a balanced binary tree for all-to-all broadcast?

Using a balanced binary tree for all-to-all broadcast has several advantages. It ensures that the time complexity of the broadcast is logarithmic, making it more efficient for large numbers of nodes. Additionally, the balanced structure of the tree allows for better load balancing and fault tolerance.

5. Are there any limitations to using a balanced binary tree for all-to-all broadcast?

While a balanced binary tree is a highly efficient data structure for all-to-all broadcast, it may not be suitable for all scenarios. For very large numbers of nodes, the tree may become too deep, resulting in a longer broadcast time. In such cases, alternative data structures may be more suitable.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
968
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
238
Replies
3
Views
2K
Replies
1
Views
588
  • Introductory Physics Homework Help
2
Replies
41
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Math Proof Training and Practice
3
Replies
100
Views
7K
  • Linear and Abstract Algebra
Replies
17
Views
4K
Replies
4
Views
2K
Back
Top