Processor Affinity in OpenCL

大兔子大兔子 提交于 2019-12-18 07:00:37

问题


Can we impose procssor affinity in OpenCl? For example thread# 1 executes on procesor# 5,
thread# 2 executes on procesor# 6, thread# 3 executes on procesor# 7, and so on ?

Thanks


回答1:


You can't specify affinity at that low level with OpenCL as far as I know. But, starting with OpenCL 1.2 have some control over affinity by partitioning into subdevices using clCreateSubDevices (possibly with one processor in each subdevice by using CL_DEVICE_PARTITION_BY_COUNTS, 1) and running separate kernel executions on each subdevice.

This would very likely run poorly on anything other than a CPU-based OpenCL implementation, and I'd have to question why you would want to do such a thing. If you want to limit CPU usage for an OpenCL-CPU implementation, you could use clCreateSubDevices to portion off some of your computing resources.

A PDF describing 'device fission' from Intel is here, and it has lots of info on how to use device partitioning and clCreateSubDevices effectively.



来源:https://stackoverflow.com/questions/10476315/processor-affinity-in-opencl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!