Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the GPU as a second processor in .Net?

Tags:

.net

gpu

The question says it all really. I'm hoping that I don't have to write the code in a c++ .dll and then call it from managed code.

like image 451
Tarks Avatar asked Jan 22 '09 19:01

Tarks


2 Answers

With a quick googling, I found this called Accelerator. Its a Microsoft Research project found here.

like image 90
Daniel A. White Avatar answered Sep 29 '22 18:09

Daniel A. White


You can write code for the GPU only using a shading language. All of the shading languages are proper languages (it's not C++, .NET languages or anything else) on their own but they are very similar to C++.

Most common shading languages are:

  • GLSL (for OpenGL)

  • Cg (the nVidia shading language compatible with both directX and OpenGL)

  • HLSL (microsoft shading language for directX).

You need to write the code you want to run on the GPU in your shading language then dynamically compile and download to the GPU. The code you use to dynamically compile and download is usually any code that supports directX/OpenGL stuff (there's Java, .NET and C++ APIs as far as I know - most people uses C++ though so most of the samples you'll find will be written in C++).

like image 28
JohnIdol Avatar answered Sep 29 '22 18:09

JohnIdol