我是 OpenCL 的新手,刚开始学习。我想知道是否可以在 GPU 上执行少量线程而在 CPU 上执行剩余线程?换句话说,如果我启动 100 个线程并假设我有 8 核 CPU,那么 100 个线程中的 8 个线程将在 CPU 上执行而剩余的 92 个线程将在 GPU 上运行吗?OpenCL 可以帮助我完成这项工作吗?顺利?
最佳答案
I wanted to know whether it is possible to execute few threads on GPU and remaining threads on CPU?
是的
In other words, if I launch 100 threads and assume that I've 8 core CPU then is it possible that 8 threads out of 100 threads will execute on CPU and remaining 92 threads will run on GPU?
不。该描述表明您会将 GPU 和 CPU 视为单个计算资源。你不能那样做。
这并不意味着您不能让两个人同时从事同一任务。
...但...
我发现更好的是让 CPU 在 GPU 工作的同时处理不同的任务。也许为 GPU 准备下一项工作,或者对 GPU 的结果进行后处理。有时这是正常的代码。有时是 OpenCL。
关于opencl - 明智地使用 GPU 和 CPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11004522/