Tuesday, January 14, 2014

Interesting Project of the Day - CudaSharp (C#'ing your GPU)

Khyperia's Coding Adventures - Making C# run on the GPU

I just spent the past few hours making a C#/CUDA library.


This library “makes C# run on the GPU”.

It takes .net IL and translates it to LLVM through a (admittedly quite feature lacking) compiler written by me. Then, it takes the LLVM bitcode and translates it to NVIDIA PTX. This PTX then can be uploaded to the GPU and executed.

The library is still an extreme work-in-progress, as I have only just started writing it a few hours ago. ...



A library to make C# run on CUDA-enabled GPUs

This library is currently far from complete and is not intended for general use.

C# is executed on the GPU like so:

  • Your C# compiler translates C# to .net CIL

  • Calling the CudaSharp.Translate method reads the CIL, translates to LLVM IR, and compilers to NVIDIA PTX

  • Use your GPU library of choice (for example, ManagedCuda) to read in the PTX file and execute it on the GPU

For an example usage, see CudaSharpTest/Program.cs


As said in the title, this is just a cool project to check out.

No comments: