問題描述
我目前正在做一個 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 看起來很棒,但尚未發(fā)布.我似乎僅限于編寫低級 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 編程的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!