2013-06-05 70 views
0

我想開始使用pyOpenCL,我遇到了運行示例的問題。我簡化了代碼,試圖弄清楚我下面發生了什麼。當我運行代碼時,它只會打印1.它不會產生任何錯誤。如果我只是調用cl.create_some_context(),也會發生同樣的情況。pyOpenCL沒有運行,沒有錯誤

我正在運行Windows 7,帶AMD CPU和ATI GPU的python 2.7。我已經更新了我的司機。從我所能找到的我的GPU不支持OpenCL,但我的CPU。

CPU:AMD速龍II X2 250

GPU:ATI的Radeon HD 4600

import pyopencl as cl 
import numpy 

print 1 
cl.get_platforms() 
print 2 
cl.create_some_context() 
print 3 

輸出:

1 

謝謝!

回答

0

要獲得關於您的問題的更多信息 - 您可能希望以更明確的方式設置您的上下文。

讓你的平臺上的設備列表:

pyopencl.get_devices(device_type = device_type.ALL) 

選擇首選設備:

for found_device in my_platform.get_devices(): 
    if pyopencl.device_type.to_string(found_device.name) == 'GPU': 
     device = found_device 

創建一個從設備類型的背景下,或(設備列表DEVICE_TYPE:ALL,GPU ,CPU):

context = pyopencl.Context(devices = None | [dev1, dev2], dev_type = None) 

我希望有幫助!

0

測試此代碼

import pyopencl as cl 
platforms = cl.get_platforms() 
len(platforms) 
gpu_devices = platforms[0].get_devices(cl.device_type.GPU) 
gpu_devices 

cpu_devices = platforms[0].get_devices(cl.device_type.CPU) 
cpu_devices