Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running MSIL on GPU

Maybe a crazy question but is it possible to run threads on the GPU?

Reason I ask is I have some quite complicated computation to execute (it's mostly maths and arrays) and would like to see if I can get any improvement in speed using the GPU.

Oh and I'd like to do this in C# or F# :)

Thanks

like image 805
Ash Avatar asked Oct 19 '11 15:10

Ash


4 Answers

There is an abstract on the topic here:

http://microsoft.cs.msu.su/Projects/Documents/ILShaders/ilshaders.pdf -- [[dead link]]

But I've yet to find a link to source. Here is the Google translated project page:

http://translate.google.co.uk/translate?hl=en&sl=ru&u=http://microsoft.cs.msu.su/Projects/Pages/ILShaders.aspx&ei=QuieTu_tGsTD8QPk-tmmCQ&sa=X&oi=translate&ct=result&resnum=2&ved=0CCYQ7gEwAQ&prev=/search%3Fq%3DILShaders%26hl%3Den%26prmd%3Dimvns -- [[deak link]]

I've looked at this topic before and haven't found anything previously that actually took a compliant language and compiled it down onto the GPU.

There are plenty of libraries that expose GPU parts but you need to understand how to express your problem in a parallel data structure kind of way. These libraries can then be referenced in C#.

Some libraries:

CUDA.NET -- dead link

Microsoft Accelerator -- dead link

Various other Q/A sources:

Utilizing the GPU with c#

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/239fd75b-05c3-4e4b-9835-6807940dc492

Update: SK-logic commented on tidepowerd, I've linked the "How It Works" section:

http://www.tidepowerd.com/product/howitworks -- [[dead link]]

This looks like a good starting point to me. Not sure if it handles the MSIL directly, it initially looks like a post build step to generate custom code under the hood.

like image 73
Adam Houldsworth Avatar answered Oct 27 '22 11:10

Adam Houldsworth


If you're using a recent NVidia GPU, you can take a look at CUDAfy.

Haven't used it, but I took at long look at them before when I was writing a .NET program for Beale's Conjecture. Good luck.

like image 25
Tim P. Avatar answered Oct 27 '22 10:10

Tim P.


Alea GPU compiles MSIL at run-time to LLVM IR and then to CUBIN so that it can execute on the GPU. As opposed to CUDAFy it is a true fully fledged compiler and not just a CUDA C code generator, which relies on the NVIDIA CUDA C++ compiler in the back end.

Their technology also allows to compile a delegate at run-time to GPU code and execute it on the GPU.

They also implemented automatic memory management with IL code instrumentation, so that the programmer does not need to copy forth and back data between the CPU and the GPU. More details on the features is on their product page.

like image 44
Daniel Avatar answered Oct 27 '22 10:10

Daniel


Probably your best bet is to use C++ AMP and then call that code from .NET in the usual way. You'll need Visual Studio 11 Developer Preview (Ultimate or Express) to get access to C++ AMP. (Never heard of C++ AMP? I have a blog post full of links.)

like image 40
Kate Gregory Avatar answered Oct 27 '22 10:10

Kate Gregory