Tutorial :How to implement efficient sorting algorithms for multiple processors with Scala?



Question:

How to implement efficient sorting algorithms for multiple processors in Scala? Here's the link for radix algorithm in GPU:

radix algorithm in GPU


Solution:1

Use scala.actors.Futures. It isn't a good solution, because you are talking about parallel computation, not concurrent computation, and Futures is aimed at the latter, not the former.

Things like parallel arrays that are coming with Java 7 and a later (not 2.8) version of Scala are more appropriate for parallel algorithms.

Just explaining, a parallel algorithm is one which does the same computation on multiple processing units. It is easy to see that each of which runs the same code. A concurrent computation is one in which each processing unit is running a potentially different code.

Also related, in parallel algorithms, the code being run doesn't change, only the data. In concurrent computation you have code changing constantly.

By the way, though that is not what you are asking, let me state that there's a library for Scala to run OpenCL code (ie, run computation on GPU). It's called ScalaCL.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »