We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 2 years ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(13)
[编辑 2017 年 10 月,因为这个答案已经很旧了]
这些答案中的大多数都已经很旧了,所以我想我应该给出我认为每个项目的最新摘要:
GPU.Net (TidePowerd) - 我在 6 个月前尝试过这个,并且确实得到了虽然需要一些工作,但它确实有效。 在编译时将 C# 内核代码转换为 cuda。 不幸的是,他们的网站已经关闭,他们的 github 已经好几年没有更新了,这可能表明该项目已经死了……
Cudafy - 开源且非常易于使用。 在运行时将 C# 内核代码转换为 cuda(具有序列化和缓存的能力)。 可以轻松地在CPU上运行相同的内核代码(主要用于调试)。 支持多个 GPU。 这里提供的示例比其他示例更多。 其他答案引用的样板代码很少,就我而言,至少有助于我理解代码的工作原理。 不过仅限 Cuda/Nvidia。 不幸的是,他们似乎也有几年没有更新他们的解决方案(2015 年最新提交——支持 cuda 7.0)。
混合器。 将 C# 编译为 CUDA 的商业解决方案。 在 Visual Studio 市场 上提供免费社区版,并在 github。
AleaGPU 商业解决方案,为消费类 GPU 提供免费社区版本。 详情请参阅丹尼尔的评论。
Brahma - 通过 OpenCL 运行 LINQ 表达式(因此也支持 AMD)。 没有太多文档/示例。 最后更新于 2011 年。
C$ - 上次开发是在 10 多年前...
Microsoft Accelerator - 同样看起来它不再被积极开发。
其他一些(C++ AMP、OpenTK -- 已死/Cloo) - 其中许多只是绑定 - 即使您能够从 C# 调用 GPU,但是您的内核代码(实际在 GPU 上运行的代码)需要用 C 或 OpenCL 编写,这意味着您必须使用(并学习)另一种语言。
正如我所说,我会推荐 Cudafy,而不是其他所有软件 - 如果它可以在 OpenCL 和 Cuda 上运行,那就完美了。
2013 年 9 月编辑
Cudafy 现在允许您针对 CUDA 和 OpenCL 进行编译,因此将在所有 GPU 上运行相同的 C# 代码。 这听起来棒极了,尽管我还没有测试过 OpenCL 编译。
[Edit OCT 2017 as even this answer gets quite old]
Most of these answers are quite old, so I thought I'd give an updated summary of where I think each project is:
GPU.Net (TidePowerd) - I tried this 6 months ago or so, and did get it working though it took a little bit of work. Converts C# kernel code to cuda at compile time. Unfortunately their website has been down and their github hasn't been updated for a couple of years, which might indicate the project is dead....
Cudafy - Open source and very easy to use. Converts C# kernel code to cuda at runtime (with ability to serialize and cache). Can easily run the same kernel code on the CPU (mostly for debugging). Supports multiple GPUs. More examples available than others here. The boilerplate code referred to by other answers is minimal, and in my case at least helped with my understanding of how the code works. Cuda/Nvidia only though. Unfortunately, it seems that they didn't update their solutions for a couple of years too (latest commit in 2015 -- support of cuda 7.0).
Hybridizer. Commercial solution compiling C# to CUDA. Provides a free community edition on visual studio marketplace and samples on github.
AleaGPU Commercial solution with a free community edition for consumer GPUS. See Daniel's comments for details.
Brahma - runs LINQ expressions via OpenCL (so supports AMD too). Not much documentation / examples. Last update in 2011.
C$ - last development was over 10 years ago...
Microsoft Accelerator - similarly doesn't look like it is being actively developed any longer.
some others (C++ AMP, OpenTK -- dead/Cloo) - many of these are just bindings - ie enable you to call the GPU from C#, but your kernel code (code which is actually run on the GPU) needs to be written in C or OpenCL, meaning you must use (and learn) another language.
As I said, I would recommend Cudafy over all the others - if it could run on OpenCL as well as Cuda it would be perfect.
EDIT SEP 2013
Cudafy now allows you to compile for both CUDA and OpenCL, so will run the same C# code on on all GPUs. This sounds fantastic, though I haven't tested the OpenCL compiling yet.
微软研究院加速器 是一个 .NET GP GPU 库。
Microsoft Research Accelerator was a .NET GP GPU library.
我发现 Brahma...它还有一个 GPGPU 提供程序,允许方法在GPU...谢谢你的问题...今天学到了一些新东西。 :)
I found Brahma... It also has a GPGPU provider that allows methods to run on the GPU... Thanks for the question... Learnt something new today. :)
这是另一个:CUDAfy。 这听起来像 GPU.Net,因为像方法属性这样简单的东西就可以导致整个方法在 GPU 上运行。 但与 GPU.Net 不同的是,CUDAfy 是免费且开源的。
GPU.Net 似乎不需要样板代码(根据他们的文档,它是“由构建工具自动注入的”),而 CUDAfy 则需要。
这里是构建与 CUDAfy 的应用程序。
Here's another one: CUDAfy. It sounds like GPU.Net, in that something as simple as a method-attribute can cause the entire method to run on the GPU. But unlike GPU.Net, CUDAfy is free and open-source.
GPU.Net appears to require no boilerplate code, though (According to their docs, it's "injected automatically by the build-tool"), while CUDAfy does.
Here is an example of building an application with CUDAfy.
我可以推荐 XNA Game Studio 作为可能的探索途径吗? 它显然是为编写游戏而准备的,但它可以让您对图形卡进行托管访问,并且比以前在 Managed DirectX 中提供的功能更好地访问功能枚举函数和着色器开发。 还有一些方法可以将 WinForms 和 XNA 组合到混合应用程序中:
http://www.ziggyware。 com/news.php?readmore=866
您必须付出一些努力来学习着色器编程(XNA 支持 HLSL),但这可能是比学习特定于供应商的解决方案(例如 nVidia 的 CUDA)更简单的方法。 优点是您可以在 100% 托管的环境中进行编程。 以下是一些 HLSL 链接:
http://www.ziggyware.com/weblinks.php?cat_id =9
GPGPU 站点也是通用 GPU 编程的推荐目的地:
http://gpgpu.org/
祝你好运!
Could I recommend XNA Game Studio as a possible avenue for exploration? It is obviously geared up for writing games, but gives you managed access to your graphics card and much better access to capability enumeration functions and shader development than was previously available in, say, Managed DirectX. There are also ways of combining WinForms and XNA into hybrid applications:
http://www.ziggyware.com/news.php?readmore=866
You'll have to put some effort into learning shader programming (XNA supports HLSL), but this may be a simpler approach than learning a vendor-specific solution such as nVidia's CUDA. The advantage is that you can program in a 100% managed environment. Here are some HLSL links:
http://www.ziggyware.com/weblinks.php?cat_id=9
The GPGPU site is also a recommended destination for general purpose GPU programming:
http://gpgpu.org/
Best of luck!
http://www.tidepowerd.com/ GPU.NET 怎么样?
How about http://www.tidepowerd.com/ GPU.NET ?
嗯,这是一个相当老的问题,自从被问到以来,事情发生了很大的变化。
使用 .Net 编写 GPU 代码的另一种选择,在 Alea GPU 的答案中没有人提到。 它涵盖了 C#、F# 和 VB。
在 F# 官方网站中,Alea 是在 GPGPU 编程中使用 F# 的第一选择。< br>
要了解这个框架,我建议查看其完整的示例列表。
Well this is a pretty old question, and since it's been asked things have changed a lot.
Another option for using .Net to write GPU code, which no one has mentioned in answers in Alea GPU. It covers C#, F# and VB.
In F# official site, Alea is the first option for using F# in GPGPU programming.
To get to know this framework I suggest take a look at its comprehensive list of examples.
除了 Brahma 之外,还可以看看 C$(发音为“C Bucks”)。 从他们的 CodePlex 网站:
它基于 C#,延迟评估,并针对多个加速器模型:
In addition to Brahma, take a look at C$ (pronounced "C Bucks"). From their CodePlex site:
It's based on C#, evaluated lazily, and targets multiple accelerator models:
有一个新的 Microsoft 解决方案 - C++ AMP(简介 此处)。
从 C# 中使用将通过 P/Invoke,如演示的 这里适用于桌面应用程序,以及此处 用于(不要称呼它)Metro 应用程序。
编辑:我应该注意到,C++ AMP 有一个 开放规范,这意味着它不一定仅适用于 MS 编译器,或仅适用于 Windows。
编辑:显然,该技术现在处于“维护模式”, 意味着他们正在修复错误,但不积极开发。
There's a new Microsoft solution in town - C++ AMP (intro here).
Use from C# would be via P/Invoke, as demoed here for desktop apps, and here for (don't-call-it) Metro apps.
Edit: I should note that C++ AMP has an open specification, which means it's not necessarily just for the MS compiler, or just for Windows.
Edit: Apparently, the technology is now in "maintenance mode," meaning they're fixing bugs, but not actively developing.
如果您的 GPU 都是同一品牌,您也许可以通过 Nvidia 的 CUDA 或 ATI 的 Stream 从供应商处获得 GPGPU 支持。 AFAIK,他们提供了 DLL,您可以通过 P/Invoke 使用它们。
If your GPUs are all the same brand, you might be able to get GPGPU support from the vendor, either through Nvidia's CUDA or ATI's Stream. AFAIK, they provide DLLs, which you could use through P/Invoke.
CenterSpace Software 在其 NMath 库中提供 GPU 支持的计算,您可以将其添加到 C# 项目中。 这是一个商业产品。
CenterSpace Software has GPU-powered computation in their NMath libraries you can add to C# project. It's a commercial product.
以某种方式管理 DirectX,可能会起作用
Managed DirectX somehow, might work
WPF 还使用 GPU,您可以使用 HLSL 添加自定义着色器。
WPF also uses the GPU and you can add custom shaders using HLSL.