加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – pyOpenCL和opencl4py之间的区别

发布时间:2020-12-16 21:30:41 所属栏目:Python 来源:网络整理
导读:今天我偶然发现了stackoverflow中的帖子(另请参见 here): We are developing 07001,higher level bindings. This project uses CFFI,so it works on Pypy. The major issue we encountered with pyopencl is that ‘import pyopencl’ does OpenCL initiali
今天我偶然发现了stackoverflow中的帖子(另请参见 here):

We are developing 07001,higher level bindings. This project uses CFFI,so it works on Pypy.

The major issue we encountered with pyopencl is that ‘import pyopencl’ does OpenCL initialization and takes the whole virtual memory in case of NVIDIA driver,preventing from correct forking and effectively disabling multiprocessing (yes,we claim that using pyopencl disables multiprocessing at least with NVIDIA). opencl4py uses lazy OpenCL initialization,resolving this “import hell”.

Later,it gained some nice features like super easy binary program caching,etc. Unfortunately,the documentation is somewhat brief. The best way to learn how it works is go through the tests.

由于还有pyOpenCL,我想知道这两个包之间的区别是什么.有谁知道我在哪里可以找到关于这两个包的专业人士和骗子的概述?

编辑:包括benshope的评论,因为我也会感兴趣:“禁用[s]多处理”是什么意思?比如,它不能同时在几个设备上运行内核?

解决方法

据我所知,没有这样的概述.我将尝试列出一些关键点:

> pyOpenCL是一个成熟的项目,拥有相对较大的用户群.有教程,常见问题解答等opencl4py出现在03/2014;没有教程,常见问题等等 – 只有单元测试和文档字符串.
> pyOpenCL是本机cPython扩展,而opencl4py使用cffi,因此它适用于PyPy(pyOpenCL不工作),并且每次cPython更改版本时都不需要重新编译.
> PyOpenCL有额外功能,例如随机数生成器和OpenGL互操作性.
> opencl4py在三星生产现实场景中进行了广泛测试,并且正在积极开发中.

what does “disable[s] multiprocessing” mean? Like,it can’t run kernels on several devices at one time?

当然,它可以,我试图说导入pyopencl后,os.fork()或multiprocessing.Process()会导致NVIDIA OpenCL用户空间库内的崩溃.在导入期间做工作总是一个坏主意.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读