适合初学者的最简单 CUDA 包装器

发布于 2024-08-17 06:32:58 字数 221 浏览 3 评论 0原文

我想开始学习如何在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小巷里的女流氓 2024-08-24 06:32:58

鉴于语言不是障碍,我想说坚持使用 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.

秋叶绚丽 2024-08-24 06:32:58

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文