CUDA within .Net environment

We’d like to port the CUDA libraries to a .Net COM environment, or otherwise make them available to Silverlight 4. Does anyone have ideas on how this could be accomplished?

GASS

ok, Thats the name of the company that created CUDA.NET wrappers… Google and check their site… (try “GASS CUDA” phrase in google)

Hello Sarnath,

Thanks for the recommendation. Have you or HCL done any work with the GASS .NET/CUDA wrappers? We’re wondering what stage of maturity they’re at. http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx# is the current URL for their free product.

Nick

Hoo-Poe is their cloud offering… They give standalone CUDA.NET wrappers as well, I believe.

We have not evaluated their product. But I think It would be just a wrapper for managed code to access “un-managed code” present in driver API and possibly CUDART as well. Just my gues…

Your program would possibly need to load “CUBIN” code (instead of directly plugging ur kernel in CS files) in that case instead of using “nvcc” directly on “cs” files… nvcc is not CS aware , I think…

You can’t call CUDA code from Silverlight, because of it’s security model (it doesn’t allow untrusted code to do any P/Invoke calls, which you’d need to access the CUDA driver). The only way you could do this was if it was an intranet-only application and you could turn off the security checks for your specific website.

EDIT: http://stackoverflow.com/questions/1234395…-in-silverlight

I’m working on a new .NET product that uses CUDA, so if you have any other questions about interop, feel free to PM me and I’ll try to answer them. On another note, I know that WPF (which Silverlight uses) has support for hardware-accelerated effects, so you might be able to do a limited amount of GPU programming based on that.

Thanks so much for this reply, it’s very helpful.

Now, with Silverlight 4, announced/beta last week, did you see that apparently some aspects of it can run in a full-trust environment, and thus it is able to make COM bridge calls and access .Net libraries? Does this help our situation? I understand that while SL can’t make Platform Invoke calls, required to get to traditional C/C++ libraries. I was thinking that the GASS .Net wrapping of the CUDA libraries might be part of the answer.

My knowledge of the fine points of .Net is pretty limited, so I don’t know if what GASS does makes the CUDA stuff look like a COM library, which would apparently do the trick.

This is another way of asking how difficult would it be to make the CUDA libraries fully COM, and thus, SL4 compatible?

One other point: we are doing all this in an end-user client application, so we’d be accessing .Net-wrapped CUDA code that is on the same machine (or on the consumer’s intranet, homegroup, Mesh). We’re not running in a Website type environment, rather we have a powerful knowledge engine running on the consumer’s hardware, and will be using CUDA/GPU for LSA and SVD matrix calcualations for semantic extraction.

I just did a bit of research and it looks like you might be able to use COM interop (a.k.a. P/Invoke) through Silverlight 4, if you’re building a desktop app.

I believe that the GASS library is more or less just a .NET wrapper around the CUDA driver. See here for more info on P/Invoke:

http://msdn.microsoft.com/en-us/library/sd10k43k.aspx

Thanks! We didn’t assume that it would be easy :)… Yes, we’re building a desktop/mobile/Mesh application. See PM for details…

Nicholas is already aware of this, but for the benefit of others who may be interested I have implemented an image processing demo in Silverlight 4 beta that can use CUDA via a COM proxy application.

http://www.planetmarshall.co.uk/2010/01/si…d-cuda-interop/

Regards,

Andrew.