|
||||||||
Title: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 10:48am I'm a student at Georgia Tech working with distributed systems. This is a unique problem I came up with in my research. This problem came from me explaining the concept of distributed computing to some friends. I've done many experiments with it but have come up empty. I've shown various professors this problem but nobody has been able to generalize it. Let's say you want to calculate the sum of 10 numbers. Let's also say it takes you 1 second to add up two numbers together. Therefore: 10 Numbers with 1 calculator would take 9 seconds to calculate. Now let's say you give a second calculator to a friend. You give the second calculator 5 calculations to calculate and yourself 5. Working simultaneously, you would take 4 seconds and your friend 4 seconds. Then you could combine these two sums (which would take 1 second) to get the overall sum in a total of 5 seconds. Therefore: 10 Numbers to sum with 2 calculators would take 5 seconds. Now let's add a third calculator. Since 10 doesn't divide evenly by 3, one calculator will do more work than the other two. Calculator A: 3 sums Calculator B: 3 sums Calculator C: 4 sums Therefore: Calculator A: Takes 2 seconds (must wait 1 second) Calculator B: Takes 2 seconds (must wait 1 second) Calculator C: Takes 3 seconds Adding all the sums takes an additional 2 seconds. This means: 10 Numbers to sum with 3 calculators would take 5 seconds. So here is the problem. Using 3 calculators doesn't save you any time. It's cheaper to use 2 calculators. So given N numbers to sum, find the minimum C calculators to use to obtain the lowest T time. A quick formula that I came up with to get the minimum time is: (N/C - 1) + (N-1) = N/C + N - 2 Note: These calculators work independently. Meaning they can't pass along sums for the other calculators to calculate to save time. This means if one calculator has more work than others the others can't do more work while it finishes. Note 2: This means that the calculators do not communicate with each other. Assume that a central server sends data to nodes and waits for all of the data to be returned and then compiles all the data. If I didn't explain this well please post what needs more clarification. Thanks! |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 11:14am on 02/18/08 at 11:13:48, towr wrote:
Removed my post following it too. No problems :-) |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 18th, 2008, 11:19am Ok, let's see if I can contribute anything useful.. As I understand it, we want to minimize http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifN/C - 1http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif + (C-1), dependent on C So, pretending it's continuous we can take the derivative wrt C and see when it's zero. -N/C2+1=0 C2=N C=http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gifN That should be in the right neighbourhood. |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 11:42am Unfortunately, Sqrt(N) is incorrect. Sqrt(N) is what I got when doing the derivative too. But look at 10. Sqrt(10) is around 3 (rounded up is 4). But as we just pointed, 2 calculators can find the minimum time (cheaper than using 3) |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 18th, 2008, 11:53am I only claimed it was in the right neighbourhood, not that it was in the right house ;) Obviously the ceiling function throws a spanner in the works. |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 18th, 2008, 12:20pm Quite the horrible little function.. If we ever figure it out, consider submitting it to http://www.research.att.com/~njas/sequences/index.html Here's a few values to work on.. (hopefully I haven't made any mistakes in generating it)
|
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 1:21pm What exactly is this sequence towr? Because the minimum increases or stays the same as N increases I have some spreadsheets, I can post them if anyone is interested. One thing I remember is that there is NEVER a case in which you should use 9 calculators... 100 uses 10, 101 uses 8! Isn't that interesting? |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 18th, 2008, 1:32pm on 02/18/08 at 13:21:46, k2xl wrote:
Quote:
Quote:
For every N=K2, you should use K calculators.. |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 1:44pm Ah right. Btw, how did you generate your list? |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 18th, 2008, 1:50pm on 02/18/08 at 13:44:53, k2xl wrote:
Code:
(If you put it on one line, it'll run in your browser, or if you have linux and firefox you can paste it as it is.) |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 1:57pm Awesome, okay. So now just to find a formula :-) |
||||||||
Title: Re: Industrial/Distributed Computing Post by Icarus on Feb 18th, 2008, 3:30pm Minimizing http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifN/C - 1http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif + (C-1) might be tough enough, but I don't think this exactly describes the situation: Suppose that you have 200 numbers to add up and 100 calculators. You can distribute the 200 numbers, get your 100 results, but it would be ridiculous at this point to use a single calculator to add up the 100 numbers. Instead, you distribute the results to 50 calculators, then those results to 25, etc. So you should be minimizing http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifN/C - 1http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif + http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.giflog2 C http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif I think. |
||||||||
Title: Re: Industrial/Distributed Computing Post by Eigenray on Feb 18th, 2008, 5:13pm It's not too hard to minimize just http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifn/chttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif + c: Let f(x) = n/x + x, F(x) = http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.giff(x)http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif. Since f(x) is minimized at x=http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gifn, it follows that the minimum value of F(x) is either F(http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lfloor.gifhttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gifnhttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rfloor.gif) or F(http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifhttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gifnhttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif). If n = k2, then it's easy to see F(k) = 2k, while F(k-1) > 2k, so C=k. If n is not a square, write n = k2 + r, 0 < r http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif 2k. Then 2k < f(k+1) = (k2+r)/(k+1) + (k+1) http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif 2k+2, so F(k+1) is 2k+1 when r http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif k, and 2k+2 when r > k. Similarly 2k < f(k) = (k2+r)/k + k http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif 2k+2, and so in fact F(k) = F(k+1). It follows that F(x) http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/ge.gif F(k) for all x, and the question is simply: what is the smallest x for which F(x) = F(k)? If r http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif k, then F(x) = F(k) when f(x) = n/x + x http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif 2k+1, or k+1/2 - http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gif{k-r+1/4} http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif x http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif k+1/2 + http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gif{k-r+1/4}, so the smallest such integer x is C = http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifk+1/2 - http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gif{k-r+1/4}http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif. Similarly, if r > k, then F(x) = F(k) when n/x + x http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/le.gif 2k+2, and the smallest such integer x is C = http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifk+1-http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/surd.gif{2k-r+1]http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif. However, it looks like what you really want to do is recursively let F(n) = min{ http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifn/c - 1http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif+ F(c) : c < n }? |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 18th, 2008, 7:15pm on 02/18/08 at 15:30:39, Icarus wrote:
Please see the note. The calculators are independent of each other. This system doesn't follow this scheme. What your suggesting is a classic distributed computing model. But many models do not function in this way. The problem is basically minimizing time and then number of calculators. |
||||||||
Title: Re: Industrial/Distributed Computing Post by Icarus on Feb 18th, 2008, 10:54pm I don't follow this. If the calculators cannot pass their results, then they cannot cooperatively sum the numbers at all, because the result of one cannot be passed to another. So in the end you are left with independent calculators each with the sum of their allotted portion, and no means to collect the totals together to find the grand total. I suppose you can demand that only one calculator can sum up the individual totals, but the only reason I could see you doing it this way in the real world is to free up the other calculators for different tasks, while one finishes off this task (whose output is not needed by other processes until the sole remaining calculator has time to finish the job). |
||||||||
Title: Re: Industrial/Distributed Computing Post by Eigenray on Feb 19th, 2008, 12:47am on 02/18/08 at 17:13:27, Eigenray wrote:
Actually, this works out to F(n) = http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.giflg nhttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif, the same as Icarus's suggestion: http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifn/c-1http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif + http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.giflg chttp://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif is minimized at c=http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/lceil.gifn/2http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/rceil.gif or c=n (among possibly other values, but the presence of two separate ceilings makes it a lot trickier to analyze). |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 19th, 2008, 1:16am on 02/18/08 at 22:54:51, Icarus wrote:
|
||||||||
Title: Re: Industrial/Distributed Computing Post by Grimbal on Feb 19th, 2008, 1:20am on 02/18/08 at 11:42:28, k2xl wrote:
I don't understand. With 3 calculators you need only 4 seconds, not 5. While the 3rd calculator does its 3rd sum, the first and 2nd calculator can combine their sums. |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 19th, 2008, 5:20am on 02/19/08 at 01:20:57, Grimbal wrote:
Please see the note. This model is simple. Think of it like this: You are a central server. You distribute data to nodes. You wait until all the nodes return you results and then you compile the results. |
||||||||
Title: Re: Industrial/Distributed Computing Post by rmsgrey on Feb 19th, 2008, 5:21am on 02/19/08 at 01:20:57, Grimbal wrote:
That's ruled out by a condition stated near the end of the original post - that all calculators need to complete their initial batch of calculations before the final summation can take place... |
||||||||
Title: Re: Industrial/Distributed Computing Post by Grimbal on Feb 19th, 2008, 6:06am Sorry, it was indeed very clear in the initial post. Note to myself: always read the fine print at the end of the page. |
||||||||
Title: Re: Industrial/Distributed Computing Post by Icarus on Feb 19th, 2008, 3:51pm on 02/19/08 at 01:16:58, towr wrote:
That depends on how much work is left to do. It seems to me that many tasks require intermediary results be shared even though the bulk of the computing remains. Collecting and redistributing should be a common enough approach. Only when you are near the end of the calculation does it make sense to leave the rest to the controller. Certainly here, if C is large enough, significant time can be saved by redistributing. I assumed that the use of summing as the task was merely because it makes it easy to understand the process. In a more realistic application, the task involved would be considerably more complex, which is why by comparison, distributing tasks is effectively free (just like you don't consider adding and subtracting when counting flops). In that case, correlating a large number of sub-processor results can still take significant time if performed by only one processor. Unless there is a great need to free up the slave processors for other tasks, it makes sense to use as many as necessary to speed up the final calculation. But this is k2xl's question, so he controls what the task is. I'll give over my grouching. |
||||||||
Title: Re: Industrial/Distributed Computing Post by towr on Feb 20th, 2008, 12:58am on 02/19/08 at 15:51:09, Icarus wrote:
I suppose the biggest issue is whether the task remains the same size (e.g. weather simulation), or gets smaller over time (adding, or other 'data aggregation'(?)). In the latter case communication very quickly becomes more costly compared to the gain from distributing. Most of the examples I've dealt with are of the latter type, where you have to work through huge amounts of data and join the results together. |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 29th, 2008, 12:26pm Bumping to see if anyone wants to give another shot :-) |
||||||||
Title: Re: Industrial/Distributed Computing Post by k2xl on Feb 29th, 2008, 12:45pm Btw, here's a spreadsheet (from data points 1-200 as posted in an earlier post) http://www.mediafire.com/?nexjsg99ho4 |
||||||||
Title: Re: Industrial/Distributed Computing Post by Eigenray on Feb 29th, 2008, 1:26pm on 02/29/08 at 12:26:29, k2xl wrote:
What was wrong with my first one? |
||||||||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |