英文:
Vector additions on GPU in golang
问题
我正在编写一个应用程序,需要每秒多次进行5000长度的浮点向量相加。是否可以让GPU执行这些计算,如何实现呢?我需要它在Windows和Linux上运行(稍后在树莓派上),所以CUDA不可行,因为我没有Nvidia显卡。
英文:
I'm writing a application that requires additions of 5000 length float vectors many times a second. Is it possible to make the GPU perform the calculations, an how would that be done? i need it to run on both windows and linux (later a raspberry pi), so CUDA is out of the question as i don't have a Nvidia graphics card.
答案1
得分: 7
你无法直接从Go语言与Nvidia GPU进行通信。你需要使用cgo来从Go语言中调用C库。在这个演示文稿的第8页中有一个示例(也可以查看完整演讲)。
有一些Go语言包将我上面提到的cgo部分封装成Go语言库。mumax就是其中一个包。
英文:
You can't directly talk to Nvidia GPUs from Go. You'd need to use cgo to call C library from Go. See slide #8 in this presentation for one example (also see full talk).
There're some Go packages that wrap cgo part I mentioned above, into Go a library. mumax is one such package.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论