PDA

View Full Version : how to run openCL on one CPU?



deNorma
12-25-2009, 11:57 AM
hi all, very simple question, just want to know how to run openCL on just one CPU.

say, my machine is multi-core, and when I set CL_DEVICE_TYPE_CPU in clCreateContextFromType, I can see the openCL program uses many cores. I want to see the performance of just one CPU. What else should I set?

Thanks!

affie
12-27-2009, 02:13 PM
Which platform are you running on?

deNorma
12-28-2009, 09:57 AM
linux, fedora 10

dbs2
01-04-2010, 08:03 AM
The only generic way to do this is to set the global work size to 1 (or use enqueue task, which does effectively the same thing). I believe there is a non-standard way to control how many CPUs the AMD implementation uses, but since OpenCL is data-parallel, there is no standard way to do this. OpenCL treats the CPUs as one data-parallel compute device and runs as many work-items across them at the same time as it can.