Consider the time for completing a task on a processor core is a distribution with mean m
and standard deviation s
. If the same task runs on n
cores, what is the mean and standard deviation of the time it takes to complete the task? (the task is finished when one of the cores finishes the task开发者_运维问答)
This is more of a statistics question, than anything else. Without information on the distribution function of the time t
a single task needs to complete, I could only give you a hint: You need to calculate the distribution function of the minimum of t
for n
of your tasks, as seen here. Using that you can then calculate the mean and the standard deviation.
PS: Is this homework?
EDIT:
Whether - and how much - it's worth to use multiple cores, depends on several things:
What you need to do. If you have to run the same program with different inputs, launching multiple instances makes a lot of sense. It might not cut down the overall time down to
1/n
and each experiment will still need at least as much time as before, but the time needed for the whole series will be signigicantly less.If on the other hand, you are hoping to run the same task with e.g. a different seed and keep the one that converges the fastest, you will probably gain far less, as estimated by the first part of my answer.
How well you have parallelized your tasks.
n
completely independent tasks is the ideal scenario.n
threads with multiple synchronization points etc are not going to be near as efficient.How well your hardware can handle multiple tasks. For example if each of these tasks needs a lot of memory, it will probably be faster to use a single core only, than forcing the system to use the swap space/pagefile/whatever your OS calls it by running multiple instances at once.
精彩评论