问题描述
我们可以在OpenCl中强加procssor亲和力吗?例如,线程1在处理器5上执行,
线程2在处理器6上执行,线程3在处理器7上执行,依此类推?
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 ?
谢谢
推荐答案
据我所知,您无法在如此低的级别上指定与OpenCL的关联性.但是,从OpenCL 1.2开始,可以使用 clCreateSubDevices (可能使用CL_DEVICE_PARTITION_BY_COUNTS, 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.
除了基于CPU的OpenCL实施之外,这很可能无法很好地运行,我不得不质疑为什么要这样做.如果要限制OpenCL-CPU实现的CPU使用率,可以使用clCreateSubDevices
分配一些计算资源.
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.
此处描述了来自英特尔的设备裂变"的PDF,其中包含有关如何使用设备的大量信息.分区和clCreateSubDevices
有效.
A PDF describing 'device fission' from Intel is here, and it has lots of info on how to use device partitioning and clCreateSubDevices
effectively.
这篇关于OpenCL中的处理器相似性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!