如何使用 CUDA 在 GPU 上运行 MATLAB 代码?
I want to run MATLAB code on the GPU using NVIDIA's CUDA. I found a couple of 3rd-party engines:
Would anyone recommend these or are there better ones out there? Any tips or suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
与 MATLAB R2010b 一起发布的并行计算工具箱现在具有 GPU 支持,包括各种数学运算的重载,以及与预先存在的 CUDA 内核的接口。
文档在这里: http://www.mathworks.com/discovery/matlab-gpu.html
Parallel Computing Toolbox released with MATLAB R2010b now has GPU support, including overloads for various mathematical operations, and an interface with pre-existing CUDA kernels.
Doc here: http://www.mathworks.com/discovery/matlab-gpu.html
您可能需要查看的其他信息来源是 NVIDIA 的 PDF 白皮书:使用 MEX 文件通过 CUDA 加速 MATLAB。
An additional source of information you may want to check out is this PDF white paper from NVIDIA: Accelerating MATLAB with CUDA Using MEX Files.
有关 Jacket 与 Matlab 与 CUDA 的比较,请查看此
http://www.accelereyes.com/products/compare
您也可以使用Jacket SDK来开发您自己的 mexfiles 以更简单、更有效的方式(内存管理方面)
For a comparison of Jacket vs Matlab with CUDA check this out
http://www.accelereyes.com/products/compare
Also you could use Jacket SDK to develop your own mexfiles in a simpler and more efficient manner (memory management wise)
总的来说,我会推荐 Accelereyes Jacket;这是您在原始帖子中的发现之一。
虽然它不是免费软件,但他们确实提供了非常可观的教育折扣。
话虽如此,就性能而言,与传统 CPU 编码相比,任何 GPU 编译器/语言/sdk 都会将矩阵/向量/代数/FFT/等代码的速度加快一个数量级或更多。即使是我个人机器上的超线程、8 路 CPU 代码,在相对便宜的 nvidiaquadro 4000 卡上通过 GPU 加速运行速度也提高了 48 倍。 (除非学校或其他人提供,否则你不需要花 2100 美元购买特斯拉!)
话虽如此,尽管我精通 c、c++、任何类型的 SQL 等……我已经编程了超过十年来,我发现夹克更容易快速有效地让我真正的研究工作加快速度。我研究了 GPUMat 和 Matlab PCT GPU,发现jacket 是一个奇怪的组合,它既强大又易于集成到 matlab 和 GPU 的外部世界中。 Jacket 的支撑力也是一流的。我通常会在 1 个工作日内得到非常有能力的答复,并且通常会在 2 天内解决问题。
对我来说,这是一个巨大的优势。我担心 GPUmat 的支持非常有限,而 matlab 虽然看似具有与 Jacket 相当的支持,但它们的支持并不是免费的。
总之,如果您需要在出色的支持下使现有代码(假设它是 GPU 并行化的可行候选者)在大约 2 周内运行速度提高 10-48 倍,那就去吧! (YMMV)
Overall, I would recommend Accelereyes Jacket; which was one of your findings in your original post.
While it is not freeware, they do give very substantial educational discounts.
Having said that, performance-wise, any GPU compiler/language/sdk is going to speed up matrix/vector/algebraic/FFT/etc code an order of magnitude or more vs. traditional CPU coding. Even hyper-threaded, 8 way CPU code on my personal machine runs 48x faster with GPU acceleration on a relatively inexpensive nvidia quadro 4000 card. (You don't need to drop $2100 on a tesla unless school or someone else is providing it!)
Having said that, although I am proficient in c, c++, SQL of any kind, etc... I have programmed for well over a decade, I found jacket to be much easier to quickly and efficiently and OPTIMALLY get my real research work up to speed. I looked into GPUMat and Matlab PCT GPU, and found jacket to be an odd combination of power and ease of integration within matlab and the foreign world of GPU's. Jacket's support is also top notch. I would get a highly competent response typically within 1 business day and resolution to problem within 2 days was typical.
To me, THAT is a huge advantage. I fear GPUmat has very limited support, and matlab, while having seemingly comparable support to jacket, their support is not free of charge.
In summary, if you need to get your existing code (assuming it is a viable candidate for GPU parallelization) running 10-48x faster in about 2 weeks with excellent support, go jacket! (YMMV)