
Hybridizer: High-Performance C# on GPUs - benaadams
https://devblogs.nvidia.com/parallelforall/hybridizer-csharp/
======
vergessenmir
I've had to grab my throwaway a/c just because I've worked on this. I've used
this framework in a commercial settings, in finance where it is gaining
popularity. Have had to work through the bugs, been through several upgrade
iterations.

When it works. It works. When it fails you're in for a world of pain. A lot is
going on behind the scenes. The data structures, classes need special
annotations to carefully translate the c# structures into something that cuda
understands. You have to pay special attention to your object hierarchy, you
have to be aware of all C# keywords that are supported and not supported. The
fields in your class may be misaligned by a few bytes of the wrong annotation
is used.

Don't get me started on cuda pointers - you're not shielded from this. My
experience with this has put me off cuda frameworks in general.

You're better off learning cuda or hiring a cuda Dev than investing heavily in
stacks like this.

My background is in HPC in finance.

~~~
AboutTheWhisles
Why would someone use C# in the first place? It seems to me that any advantage
from the environment has gets lost by trying to make it work on a GPU.

~~~
sebazzz
I was going to say something similar to this. Usually such abstractions are
leaky. I don't know the target market for this product. The one's who know
CUDA will just use C++. The one's who know C++ won't use this. The one's who
do not know CUDA will probably not use this because they will need to learn
CUDA first anyway.

(Same story with those C# to Javascript compilers)

------
taspeotis
There's some interesting stuff in the .NET-on-hardware space, CUDAfy [1] has
been around for a while and I recently stumbled upon Hastlayer [2].

[1] [https://cudafy.codeplex.com/](https://cudafy.codeplex.com/)

[2] [https://hastlayer.com/](https://hastlayer.com/)

~~~
benaadams
Also Alea GPU [1]

[1]
[http://www.aleagpu.com/release/3_0_4/doc/introduction.html](http://www.aleagpu.com/release/3_0_4/doc/introduction.html)

~~~
samuell
Yeah, would be great with some comparison to Alea ... optimally a point-to-
point comparison.

------
MaxBarraclough
Ctrl-f for "garbage", "memory", or "allocate", and find nothing.

Am I to assume the point here is to allow the C# programmer to run tight loops
of parallel numerical code on the GPU, with minimal adaptation?

They support virtual functions, though.

Neat project either way, but the scope isn't clear.

~~~
pjmlp
You also don't realy allocate in C or C++ GPU code, beyond what is done before
calling it, setting up buffers.

------
Athas
Does this solve some of the core problems with GPU programming, such the
difficulty of writing reusable code without significant performance overhead
(via nested parallelism or fusion), or the need to follow some potentially
awkward rules for performance reasons (struct-of-arrays and coalesced memory
access patterns?).

I mean, it is surely nice to easily launch a bunch of threads within a single-
source program, but there are already plenty of C++ libraries that let you do
this, and it has not really led to an explosion of making efficient GPU
programming accessible to the layman.

~~~
arianvanp
If you want composable kernels in a high level language, I can really
recommend
[http://hackage.haskell.org/package/accelerate](http://hackage.haskell.org/package/accelerate)

with the CUDA backend: [https://hackage.haskell.org/package/accelerate-llvm-
ptx](https://hackage.haskell.org/package/accelerate-llvm-ptx)

See
[http://chimera.labs.oreilly.com/books/1230000000929/ch06.htm...](http://chimera.labs.oreilly.com/books/1230000000929/ch06.html)
for a great introduction

------
sydd
Looks really neat, its a pity that you are hardware-locked so its not usable
to general apps like games.

~~~
EpicEng
What would the use case for games be? We already have plenty of graphics
libraries which abstract the GPU from the developer (kinda sorta). This is for
number crunching.

------
srean
Any good library for matrix and linear algebraic operations ?

I would be interested in anything that can serve as good building block
material that has a good set of primitives built in.

~~~
pjmlp
Yes, IMSL Numerical Libraries have good .NET support.

[https://www.roguewave.com/products-services/imsl-
numerical-l...](https://www.roguewave.com/products-services/imsl-numerical-
libraries)

~~~
srean
Thanks. Good to know. Seems closed source (nothing wrong there, just fyi for
others)

