Selecting number of CPU cores in OpenCL
I am comparing performance of OpenMP with that of OpenCL on CPUs and my system has 8 co开发者_如何转开发res. But I need comparisons for 2, 4, 6 and 8 cores respectively. I can activiate number of cores in OpenMP through "set_num_threads(n)" function or an environment variable; But I dont know how could I do same in OpenCL, is there alternative of OpenMP set_num_threads API in OpenCL ?
There is no standard way to do this. OpenCL will try to use all of the resources available on an OpenCL device.
One possibility you could look into is the device fission extension. It allows you to divide the device (in this case the CPU) into smaller logical devices. It is currently supported on CPUs by AMD's implementation at least. Do a search and you'll find some more resources from AMD as well.
精彩评论