BT

InfoQ Homepage News Using C# to Target GPUs

Using C# to Target GPUs

Bookmarks

Writing general purpose programs to take advantage of NVIDIA GPUs has long meant using NVIDIA’s CUDA platform.  While CUDA supports several different programming languages, writing high-performance code typically required the use of C or C++. Until recently, this arrangement left out C# developers who would otherwise have to leave their preferred language behind in order to write code targeting GPUs.

A new compiler tool from Altimesh, Hybridizer, is intended to address this issue by providing C# developers with a way to target GPUs by producing a CUDA binary from their C# source.  Hybridizer is split into two versions, with each targeting different needs and budgets.  Hybridizer Essentials is free to all and is provided as a Visual Studio extension.  It produces binaries for the CUDA platform.  Hybridizer Software Suite (HSE) is licensed software that allows the targeting of CUDA, as well as other platforms that include AVX, AVX2, and AX512.  The software suite produces binaries, but will also optionally produce CUDA source code to allow users to audit what is being compiled.

Either option paired with NVIDIA’s Nsight Visual Studio Edition provides developers with the means to write and debug C# code in Visual Studio while the resulting code executes on the NVIDIA GPU.  Since the HSE fundamentally operates on MSIL (Microsoft Intermediate Language), it can integrate with existing projects even if the source code is not available.  This also provides indirect support for fellow .NET platform languages F# and VB.NET.  

Since one of the goals of writing C/C++ code for the CUDA platform is maximum performance, it is worth comparing the performance C# code compiled by Hybridizer.  According to Altimesh, the binaries generated from C# achieved 83% of the performance from the handwritten C++ code targeting CUDA.  With some hands-on involvement of its own, the C# code was further improved to match the performance of the C++ equivalent.

The Hybridizer software provides C# developers curious about CUDA and GPU programming with a way to explore these technologies without leaving their preferred technology behind.  Sample code is available on GitHub and the Hybridizer Essentials extension is available on the Visual Studio Marketplace.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.