用
import pyopencl as cl
platform = cl.get_platforms()[1]
device = platform.get_devices()
我有两个设备:
<pyopencl.Device 'Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz' on 'Intel(R) OpenCL' at 0x9f7a0e0>,
<pyopencl.Device 'Intel(R) HD Graphics 4000' on 'Intel(R) OpenCL' at 0x9efdab0>
带
device = platform.get_devices()[0]
我选择CPU作为我的设备。但是,如果我使用CPU来创建上下文(ctx = cl.Context([device]))。我收到了这个错误:
RuntimeError: clCreateContext failed: DEVICE_NOT_AVAILABLE
但是上下文适用于我的两个GPU(Intel Graphic和GTX970 on platform [0])。
知道这个错误发生的原因吗?
非常感谢
嘉俊