python - 我不能通过 ctypes 通过 Python 使用 OpenCL
问题描述
我正在尝试通过 pythons ctypes 库通过 python 使用 opencl。在我正在使用的新机器上,没有任何工作了。我收到以下错误:
回溯(最后一次调用):文件“D:\why_like_this.py”,第 10 行,在 succ = clGetPlatformIDs(1,pIDs,0) OSError:异常:访问冲突写入 0x0000000000000000
以下是导致问题的简单 python 代码:
import ctypes
opencl = ctypes.WinDLL('OpenCL')
clGetPlatformIDs = opencl.clGetPlatformIDs
clGetPlatformIDs.restype = ctypes.c_int32
clGetPlatformIDs.argtypes = [ctypes.c_uint32, ctypes.c_void_p, ctypes.c_void_p]
pIDs = (ctypes.c_int64*1)()
succ = clGetPlatformIDs(1,pIDs,0)
解决方案
问题是糟糕的运行时库。重新安装系统的视频驱动程序后,错误消失了。
推荐阅读
- c# - 无法从存储库调用 DBContext 构造函数
- ros - Ros 发射卡在 5G 网络中的机器人上
- android - 我无法启动 avd 模拟器 (android studio) 或在我的设备中进行测试
- python - 如何通过pandas Dataframe中的input()按内容查找索引?
- haskell - Haskell 实现一个带有折叠功能的过滤器列表
- ios - 未找到单元“FMX.WebBrowser.Delegate.Cocoa”
- javascript - Swup.js + Oxygen (wp) - 没有加载正确的站点?
- c# - 独立于 CultureInfo.Calendar 获取 DateTime
- django - Django Model.objects.get(...) 不区分大小写
- php - 如果在智能 php 中创建带有日期的语句