且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让已经编写好的并发程序在 GPU 阵列上运行?

更新时间:2023-10-03 08:27:46

不,使用 CUDA 不是小事.

No, using CUDA is not a trivial matter.

CUDA 编程模型基本上使用 C(添加了一些内容),但为了充分利用 GPGPU 的功能,您必须确保您的算法遵循 CUDA 指南.(参见NVidia CUDA 编程指南)

The CUDA programming model basically uses C (with some additions) but in order to get the most of the GPGPU's capabilities you would have to ensure that your algorithms follow the CUDA guidelines. (see NVidia CUDA Programming Guide)

例如,为了获得***内存性能(大约 70Gbps),您需要在流模式下通过合并访问内存,而且 GPU 上的分支成本非常高,因此您应该尽可能避免使用条件语句.查看 SDK 提供的指南和示例,它们将提供一个很好的起点

For example in order to get the best memory performance (somewhere around 70Gbps) you need to access memory in streaming mode with coalescing, also branches are very costly on the GPUs so you should avoid conditionals as much as possible. Check out the guide and samples provided with the SDK, they'll provide an excellent starting point