Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some hints that an algorithm should parallelized?

My experience thus far has shown me that even with multi-core processors, parallelizing an algorithm won't always speed it up noticably. In fact, sometimes it can slow things down. What are some good hints that an algorithm can be sped up significantly by being parallelized?

(Of course given the caveats with premature optimization and their correlation to evil)

like image 359
Jason Baker Avatar asked Mar 23 '09 03:03

Jason Baker


2 Answers

To gain the most benefit from parallelisation, a task should be able to be broken into similiar-sized course-grain chunks that are independent (or mostly so), and require little communication of data or synchronisation between the chunks.

Fine-grain parallelisation, almost always suffers from increased overheads, and will have a finite speed-up regardless of the number of physical cores available.

[The caveat to this, is those architectures that have a very large no. of 'cores' (such as the connection machines 64,000 cores). These are well suited to calculations that can be broken into relatively simple actions assigned to a particular topology (like a rectangular mesh).]

like image 183
Mitch Wheat Avatar answered Oct 24 '22 14:10

Mitch Wheat


If you can divide the work into independent parts then it may be parallelized well.

Remember also Amdahl's Law which is a sobering reminder of how little we can expect in terms of performances gains by adding more cores to most programs.

like image 28
Assaf Lavie Avatar answered Oct 24 '22 13:10

Assaf Lavie