Python GPU 编程

Python GPU programming(Python GPU 编程)

本文介绍了Python GPU 编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做一个 python 项目,我想利用 GPU 进行一些计算.

I am currently working on a project in python, and I would like to make use of the GPU for some calculations.

乍一看似乎有很多可用的工具;乍一看,我觉得我错过了什么.

At first glance it seems like there are many tools available; at second glance, I feel like im missing something.

Copperhead 看起来很棒,但尚未发布.我似乎仅限于编写低级 CUDA 或 openCL 内核;没有推力,没有cudpp.如果我想整理一些东西,我必须自己做.

Copperhead looks awesome but has not yet been released. It would appear that im limited to writing low-level CUDA or openCL kernels; no thrust, no cudpp. If id like to have something sorted, im going to have to do it myself.

这对我来说似乎不太正确.我真的错过了什么吗?还是这种 GPU 脚本还没有达到宣传的效果?

That doesnt seem quite right to me. Am I indeed missing something? Or is this GPU-scripting not quite living up to the hype yet?

GPULIB 似乎是我需要的.文档很简陋,python 绑定只是顺便提及,但我现在正在申请下载链接.任何人都有这方面的经验,或者有类似的免费学术使用 GPU 库的链接?重新好的,python 绑定实际上不存在.

GPULIB seems like it might be what I need. Documentation is rudimentary, and the python bindings are mentioned only in passing, but im applying for a download link right now. Anyone has experience with that, or links to similar free-for-academic-use GPU libraries? Re ok, python bindings are infact nonexistant.

Edit2:所以我想我最好的选择是在 C/CUDA 中编写一些东西并从 python 中调用它?

So I guess my best bet is to write something in C/CUDA and call that from python?

推荐答案

PyCUDA 提供了非常好的与 CUDA 集成,并具有多个帮助接口,使编写 CUDA 代码比在直接 C api 中更容易.Here 是来自 Wiki 的一个示例,它完全不需要任何 C 代码就可以进行 2D FFT.

PyCUDA provides very good integration with CUDA and has several helper interfaces to make writing CUDA code easier than in the straight C api. Here is an example from the Wiki which does a 2D FFT without needing any C code at all.

这篇关于Python GPU 编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Python GPU 编程