Using C# to Target GPUs

| by Jeff Martin Follow 17 Followers on Dec 28, 2017. Estimated reading time: 1 minute |

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 Stage

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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you