Cool_Coder
Cool_Coder

Reputation: 5073

How to obtain number of cores for OpenCL devices?

In my application I want to display various OpenCL devices to the user. I am not able to decide how I show the number of cores in the device. This is just to give an idea about how many threads can run in parallel simultaneously.

Compute units tells us the number of multi processor, this can be obtained by CL_DEVICE_MAX_COMPUTE_UNITS. To determine how many threads are supported by each multi processor is CL_DEVICE_MAX_WORK_GROUP_SIZE the correct parameter?

The following results are obtained on my laptop:

ATI 7670m GPU
CL_DEVICE_MAX_COMPUTE_UNITS = 6
CL_DEVICE_MAX_WORK_GROUP_SIZE = 256

Intel 3rd gen i5
CL_DEVICE_MAX_COMPUTE_UNITS = 4
CL_DEVICE_MAX_WORK_GROUP_SIZE = 1024

So my GPU has 1536 thread support while CPU has support for 4096 threads? This is obviously not true, hence require some help on this.

Upvotes: 4

Views: 2941

Answers (2)

Roman Arzumanyan
Roman Arzumanyan

Reputation: 1814

Number of Computing Units is closer to naive "core" definition. But, taking into accout that it may has arbitrary hardware architecture, in my opinion, it can only confuse user.

Mapping between OpenCL essences & hardware is very shaky.

Upvotes: 1

Tim
Tim

Reputation: 2796

CL_DEVICE_MAX_WORK_GROUP_SIZE is the maximum allowable number of elements in a workgroup. This doesn't relate to the amount of parallelism. That is, there is no rule that all work items in a work group execute in parallel, and I know of implementations where they don't. (There are ways of dealing with workgroup synchronization constructs like barriers.)

The other value CL_DEVICE_MAX_COMPUTE_UNITS is vaguely defined as well unfortunately. With Intel at least, the number of "compute units" typically is processors, but for CPUs that's one HW thread, and GPU's one EU with several lanes of execution. I don't know ATI as well, but I bet the 6 units probably offer significantly more parallelism than 4 "units" in the CPU implementations. In other words, the "units" are apples and oranges. The 1024 and 256 from max workgroup size are unrelated to the calculation.

Upvotes: 1

Related Questions