在golang中使用GPU进行向量相加操作

huangapple go评论63阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2017年1月2日 00:06:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/41416808.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定