运行在GPU的C#代码 [英] Run C# code on GPU
问题描述
我没有GPU的编程概念和API的知识。我有几个问题:
I have no knowledge of GPU programming concepts and APIs. I have a few questions:
- 是否有可能写一张托管的C#代码和编译/它翻译成某种模块,它可以在GPU上执行的?还是我注定有两种实现方式,一种为CPU上管理,一个用于GPU(据我所知,会有什么可以在GPU上执行的限制)?
- 是否存在一个体面和成熟的API来对各种GPU硬件厂商独立程序(即通用API)?
- 是否有任何的最佳做法,如果一个人想开发一个CPU上运行的应用程序,写在托管语言,并且还提供了速度优化,如果合适的GPU硬件存在?
我也很高兴,链接到任何类型的用适当的学习资源的文档。
I would also be glad for links to any kind of documentation with appropriate learning resources.
最佳,
约瑟夫
Best, Jozef
推荐答案
1)否 - 不是C#的一般情况 - 明明什么都可以为语言的一些子集创建
1) No - not for the general case of C# - obviously anything can be created for some subset of the language
2)是 - HLSL使用的Direct X或Open GL
2) Yes - HLSL using Direct X or Open GL
3)不太可能的 - CPU和GPU编码是根本不同的。
3) Not generally possible - CPU and GPU coding are fundamentally different
基本上你可以' ŧ认为CPU和GPU编码作为是可比的。 GPU的是一个高度专业化的并行处理工具 - 为许多并行简单的计算的。
Basically you can't think of CPU and GPU coding as being comparable. A GPU is a highly specialised parallel processing tool - for lots of parallel simple calculations.
在尝试,有很多分支机构等的GPU编写一个通用编程'就不会是有效的 - 甚至是不可能的。
Trying to write a general progam in a GPU with lots of branches etc just won't be efficient - maybe not even possible.
他们的存储访问架构是完全不同的。
Their memory access architectures are totally different.
您应该写为CPU,但种田了相应的并行计算到GPU。
You should write for the CPU but farm out appropriate parallel computations to the GPU.
这篇关于运行在GPU的C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!