本文介绍了Python GPU编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我目前正在一个项目在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。如果id喜欢有东西排序,我自己要做。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的绑定只是顺便提及,但im现在申请下载链接。任何人都有这方面的经验,或链接到类似的免费为学术使用的GPU图书馆? 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更容易。 此处是Wiki中的示例,它执行2D FFT,而不需要任何C代码。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编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 17:04