mans
mans

Reputation: 18168

How to calculate max number if thread that my kernel runs on them in opencl

when I read the device info from an OpenCL device, how can I calculate how good is its processing capability?

To add more information, assume that I want to do a very simple task on a pixels of an image, as far as I know (which maybe is not right !) when I run my kernel on a GPU, opencl runs it in parallel with different processing unit in GPU and I can think of the kernel as the thread body which would run in parallel.

If this is correct, then for my simple task, I need to find the device that has more processing unit so my kernel runs on them and hence finishes faster. Am I wrong?

How to find a suitable device based on its processing power?

Upvotes: 0

Views: 133

Answers (1)

Lubo Antonov
Lubo Antonov

Reputation: 2318

Counting the number of processors in an OpenCL device is not sufficient to know how it will perform, for many reasons:

  1. Different processors can have very different frequencies (in MHz/GHz)

  2. Different processors can have very different architectures, e.g. out-of-order, multi-scalar, functions implemented in hardware

  3. Different OpenCL devices have different types of memory available to them, which can affect the overall performance to a large extent

  4. OpenCL devices could be integrated with the main CPU, on discrete peripheral board, or across a network. The latency and the need to synchronize or copy memory will affect the performance.

  5. Different algorithms favor different architectures, so while one device may be faster than another for one algorithm, the same may not be true for a different algorithm.

I don't recommend using the number of processors as a measure of performance. The best way is to benchmark with a specific algorithm.

Upvotes: 1

Related Questions