Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What kind of work benifits from OpenCL

First of all:

  • I am well aware that OpenCL does not magically make everything faster
  • I am well aware that OpenCL has limitations

So now to my question, i am used to do different scientific calculations using programming. Some of the things i work with is pretty intense in regards to the complexity and number of calculations. SO i was wondering, maybe i could speed things up bu using OpenCL.

So, what i would love to hear from you all is answers to some of the following [bonus for links]:

*What kind of calculations/algorithms/general problems is suitable for OpenCL

*What is the general guidelines for determining if some particular code would benefit by migration to OpenCL?

Regards

like image 905
Daniel Avatar asked May 19 '10 22:05

Daniel


2 Answers

I think this is a good question, and it's something I'm trying to work out for my own research as well.

There are, at the moment, strong limitations in terms of what GPUs can do, as they require individual threads to execute exactly the same code on different sets of data, i.e. the problem / algorithm must be "data parallel". Obviously data parallel problems include Monte Carlo simulations (where many MC simulations are executed in parallel), image processing, and less obviously molecular dynamics simulations. Numerical integration (Monte Carlo or otherwise) is another scientific application which can be easily ported to running on a GPU.

The other main restriction is that memory per thread is very limited, and so to be efficiently executed on a GPU the algorithm must have high arithmetic intensity. A necessary but not sufficient condition for an algorithm to be a candidate for running on a GPU is that on the CPU the algorithm must be strongly CPU bound rather than memory bound.

My view is that as time goes on, more and more problems will be shoehorned so that they can be solved using this paradigm just because there is such a large performance gain to be made, but the low hanging fruit are the obviously data parallel problems. Massively multicore programming is, in my view, going to be increasingly important and prevalent in scientific circles over the next decade.

I've played around with this a bit, and managed to shoehorn a backtracking problem into an appropriate format for executing on a GPU (using CUDA). FYI, I describe this in a talk: http://lattice.complex.unimelb.edu.au/home/sites/default/files/mydocuments/clisby_cuda0509.pdf

like image 125
Nathan Avatar answered Sep 22 '22 18:09

Nathan


It's well suited to tasks that can be expressed as a somewhat small program working in parallel over large chunks of simple data structures.

If want to compute the difference between two images, OpenCL is for you. If you want to ray-trace a scene, it's somewhat difficult but still feasible. If you have answer large amounts of web-service requests, OpenCL is not the solution.

like image 33
Malte Clasen Avatar answered Sep 22 '22 18:09

Malte Clasen