是否可以用纯 Haskell 语言对 GPU 进行编程?
我想知道我是否可以用纯 Haskell 编写应该由 GPU 评估的代码。
例如,GPU 中两个大矩阵相乘的函数(理论上)没有副作用,因此可以从纯 Haskell 函数中调用它。
但我也担心,如果我只是通过 FFI 将 CUDA C++ 程序作为纯函数包装到 Haskell,是否会出现问题。据我从文档中了解到,我必须确定没有副作用,但我根本不确定。
所以我的问题是:
- 如果我将 C++ CUDA 函数作为纯函数包装到 Haskell 中,是否有什么东西可能会破坏?
- 是否有一些库,使我能够仅使用纯 Haskell 来对 GPU 进行编程,而不使用 Haskell FFI?
- 如果没有的话,理论上可以制作吗?
谢谢。
I wonder, whether I can write code, which ought to be evaluated by GPU, in pure Haskell.
For example, a function for multiplication of two large matrices in GPU have (theoretically) no side effects, therefore it might be possible to call it from pure Haskell function.
But I am also worried, whether something don't get broken, if I just wrap CUDA C++ procedures to Haskell via FFI as pure functions. As I understand from the documentation, I must be sure, that there are no side effects and I am not sure at all.
So my questions are:
- Is there something, what might break, if I wrap C++ CUDA function to Haskell as a pure function?
- Is there some library, which enables me to use just pure Haskell to program GPU without usage of Haskell FFI?
- If not, is it theoretically possible to make one?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论