C#: Perform Operations on GPU, not CPU (Calculate Pi)

C#.NetApiGpu

C# Problem Overview


I've recently read a lot about software (mostly scientific/math and encryption related) that moves part of their calculation onto the GPU which causes a 100-1000 (!) fold increase in speed for supported operations.

Is there a library, API or other way to run something on the GPU via C#? I'm thinking of simple Pi calculation. I have a GeForce 8800 GTX if that's relevant at all (would prefer card independent solution though).

C# Solutions


Solution 1 - C#

It's a very new technology, but you might investigate CUDA. Since your question is tagged with C#, here is a .Net wrapper.

As a bonus, it appears that your 8800 GTX supports CUDA.

Solution 2 - C#

Another option that hasn't been mentioned for GPU calculation from C# is Brahma.

Brahma provides a LINQ-based abstraction for GPU calculations - it's basically LINQ to GPU. It works over OpenGL and DirectX without extra libraries (but requires SM3). Some of the samples are fairly amazing.

Solution 3 - C#

You might want to look at this question

You're probably looking for Accelerator, but if you are interested in game development in general I'll suggest you take a look at XNA

Solution 4 - C#

CUDA.NET should be exactly what you're looking for, and it seems to support your specific graphics card.

Solution 5 - C#

You can access the latest Direct3D APIs from .NET using the Windows API Code Pack. Direct3D 11 comes with Compute Shaders. These are roughly comparable to CUDA, but work also on non-NVIDIA GPUs.

Note that Managed DirectX and XNA are limited to the Direct3D 9 feature set, which is somewhat difficult to use for GPGPU.

Solution 6 - C#

There is a set of .Net bindings for Nvidia's CUDA api, it's called CUDA.net. You can refer to the reference guide to look at some sample C# code.

The preferred way to access your co-proccesor (GPU) would be using OpenCL so that your code would be portable with ATI cards, but I believe there may be additional coding required and I'm not sure how much support OpenCL has for the .Net platform.

If you want to use C++, here's a quick overview on how to get some sample code compiling with Visual Studio.

Solution 7 - C#

FYI: Accelerator (http://research.microsoft.com/en-us/projects/Accelerator/) was working great for a couple of tests.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexView Question on Stackoverflow
Solution 1 - C#Charlie SaltsView Answer on Stackoverflow
Solution 2 - C#Reed CopseyView Answer on Stackoverflow
Solution 3 - C#TchamiView Answer on Stackoverflow
Solution 4 - C#Michael BorgwardtView Answer on Stackoverflow
Solution 5 - C#Malte ClasenView Answer on Stackoverflow
Solution 6 - C#DarwynView Answer on Stackoverflow
Solution 7 - C#AlexView Answer on Stackoverflow