PyCUDA 和 NumbaPro CUDA Python 有什么区别?

What is the difference between PyCUDA and NumbaPro CUDA Python?

我是 CUDA 的新手,我想弄清楚 PyCUDA (free) or NumbaPro CUDA Python(不是免费的)对我来说是否更好(假设图书馆费用不是问题)。

两者似乎都要求您使用各自的 Python 方言。但是,PyCUDA 似乎要求您在 C 代码中编写内核函数,这比使用 NumbaPro 更麻烦,NumbaPro 似乎为您完成了所有繁重的工作。

真的是这样吗?会有显着的性能差异吗?

numbapro now is numba BSD 许可证也是免费的。

根据 this 报告,pyOpenCL 和 pyCUDA 比 numba 快 5 倍

让我们来谈谈这些库中的每一个:

PyCUDA:

PyCUDA is a Python programming environment for CUDA it give you access to Nvidia's CUDA parallel computation API from Python. PyCUDA是用C++(基础层)写的,Python,C++代码会在NVIDIA芯片上执行,Python代码编译,执行,获取 C++ 代码的结果并自动管理资源,使其成为强大的 CUDA 库之一。

PyCUDA 与 PyOpenCl 略有不同,可用于 运行 各种平台上的代码,包括 Intel、AMD、NVIDIA 和 ATI 芯片。不像 PyCUDA 只能在 NVIDIA 芯片上 运行:

Python + CUDA = PyCUDA

Python + OpenCL = PyOpenCL

NUMBA/NumbaPro:

NUMBA : NumbaPro or recently Numba (NumbaPro has been deprecated, and its code generation features have been moved into open-source Numba.) is an Open Source NumPy-aware optimizing compiler for Python sponsored by Anaconda, Inc. It uses the remarkable LLVM compiler infrastructure to compile Python syntax to machine code. Numba 支持在 CPU 或 GPU 硬件上将 Python 编译为 运行,它基本上是用 Python 编写的。它易于安装和实施。

正如@Wang 提到的,Pycuda 比 Numba 快。