可以跨越一个OpenCL内核以在CPU和GPU上同时运行 [英] Is possible to span an OpenCL kernel to run concurrently on CPU and GPU
问题描述
让我们假设我有一台装有多核处理器和GPU的计算机.我想编写一个在平台的所有内核上运行的OpenCL程序.这可能吗,还是我需要选择一个可以在其上运行内核的设备?
Lets assume that I have a computer which has a multicore processor and a GPU. I would like to write an OpenCL program which runs on all cores of the platform. Is this possible or do I need to choose a single device on which to run the kernel?
推荐答案
理论上可以,CL API允许.但是平台/实现必须支持它,我认为大多数CL实现都不支持.
In theory yes, you can, the CL API allows it. But the platform/implementation must support it, and i don't think most CL implementatations do.
要执行此操作,请获取CPU设备和GPU设备的cl_device_id,并使用clCreateContext创建与这两个设备的上下文.
To do it, get the cl_device_id of the CPU device and the GPU device, and create a context with those two devices, using clCreateContext.
这篇关于可以跨越一个OpenCL内核以在CPU和GPU上同时运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!