适合初学者的最简单 CUDA 包装器
我想开始学习如何在 CUDA 中编程,不仅仅是语言,还有程序设计——比如——据我所知——编写没有条件的内核,以便所有线程运行相同的指令,并且有最小的同步开销。
据我所知,Python 包装器的使用和编码比 C 库更加直观。
因此,假设我已经知道/不知道的语言不是障碍,那么最好使用哪种语言开始学习 CUDA?
哪一个可以让您最好地了解 CUDA 中的注意事项以及最简单的学习曲线?
I want to start learning how to program in CUDA, not just the language, but program-design -- things like -- from what I've heard -- writing kernels without conditionals so that all the threads run the same instructions and there's minimal synchronization overhead.
And from what I've heard, the python wrapper is a lot more intuitive to use and code with than the C library.
So assuming that the languages I already know/don't know aren't a barrier, which language is it best to start learning CUDA in?
Which one gives you the best idea of the DO's and DONTs in CUDA and the easiest learning curve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
鉴于语言不是障碍,我想说坚持使用 C/C++ 将为您留下更多可用资源。还有更多潜在的陷阱,但如果您查看 CUDA 最佳实践指南(随 NVIDIA 上的 CUDA 工具包提供)网站)那么您就会走在正确的道路上。
您还可以考虑查看开源项目“Thrust”,它是一个 STL/ Boost 样式模板库构建在 CUDA C++ 之上。它在许多情况下运行良好,随着您了解更多,您可以调用更复杂的内核。
Given that languages aren't a barrier, I would say that sticking to C/C++ would leave more resources available to help you. There are more potential pitfalls but if you take a look in the CUDA Best Practices Guide (provided with the CUDA toolkit on the NVIDIA website) then you'll be on the right track.
You could also consider looking at the open-source project "Thrust" which is a STL/Boost style template library built on top of CUDA C++. It works well in many cases and you can just call more complex kernels as you learn more.
您可以阅读最佳实践指南 也可以通过 THRUST 模板。对于 Python 绑定,请查看 Michael 在这些 幻灯片中讨论的 Copperhead花环
You can go through the Best Practices Guide and also through the THRUST template. For Python binding, look at Copperhead talked about in these slides by Michael Garland