CUDA with C# 3.0 (VS 2008 C#)?

Hi Folks:
I am just getting started with all these. I am think about calling CUDA code/kernel from my C# code. I want my CUDA code to do some image processing stuff, then my main program in C# handles the logic. I am using VS2008 C#, CUDA 5.0. (I am not even sure if they’re compatible) Here is what I found.

Use a third party wrapper above CUDA driver, options are :
    CUDA.NET: it is kinda old, little support document, no example found yet
    CUDAfy.NET: looks promising, with examples and ducument supporting, but it seems only compatible wtih .NET 4.0 or above.
Writing a wrapper myself: I am not confident, unless there is an example; Unfornately, I have not found much relevant material talking about CUDA with VS2008 C#
Any other options?

I appreciate any suggestions.

As far as I know CUDA.NET is a commercial library (one need to pay to use it, but trial is available). Indeed CUDAfy is a promising one but, to my knowledge, it lacks some of CUDA features (e.g. textures management, but dunno exactly). Writing a wrapper Yourself is a hard, time-consuming task which I not recommend.

MK

OK. So it seems none of them is good.
Someone mentioned C++ AMP; Is that an good solution?

You can try MC# (www.mcsharp.net).
A simple vector addition program in MC# looks like as

using System;
using GpuDotNet.Cuda;

public static class VectorAddition {

 public static void Main ( String[] args )
{

  int   N = Convert.ToInt32 ( args [ 0 ] );  
  Console.WriteLine ( "N = " + N );
  
  int[]   A = new int [ N ];
  int[]   B = new int [ N ];
  int[]   C = new int [ N ];
  
  for ( int i = 0; i < N; i++ ) {
   A [ i ] = i;
   B [ i ] = i + 1;
  }
  
  GpuConfig gpuconfig = new GpuConfig();
  gpuconfig.SetBlockSize ( N );
  gpuconfig.vecadd ( A, B, C );
  
  for ( int i = 0; i < N; i++ ) 
   Console.WriteLine ( C [ i ] ); 
 }
 
 public static gpu vecadd ( int[] A, int[] B, int[] C ) { 
  int   i = ThreadIndex.X;
  C [ i ] = A [ i ] + B [ i ]; 
 }
}

It says “integration with Microsoft Visual Studio 2010”, but I am really using VS2008, which is .NET 3.5, which is C# 3.0;
Any thoughts?

Indeed, VS2008 is a very old version - the latest version is VS2012.
So the simplest way to try MC# with GPU support is to install (free) VS2010 Express
(http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express).

Additional questions you can place at MC# forum (http://mcsharp.net/phpBB3/index.php).

The reason why I am sticking with vs2008 is that the project has been developed by vs2008 for a long time, and I am not the person who can decide whether to move to 2010/2012 or not.
So I came here to see if someone knows how to integrate a CUDA dll in to vs2008 C#, if there actually is a way to do so.

I think that you go to the problem from the wrong end, because a GPU programming is
a very specific thing.
First of all, you need to decide is it possible to do your stuff on GPU at all.
So it’s better to implement a simple part of your stuff within any VS
or without it at all and then to decide questions concerning VS.

I think what you’re looking for is [url]http://managedcuda.codeplex.com/[/url] : it is a complete CUDA wrapper written in C#. The binaries are .net 4.0 but you can compile it yourself to .net 2.0.

CUDA™ is a parallel computing platform and programming model ,then i think we need an C# image library work that can do processing well.

Here is a gudie page that provides sample code and detailed steps for image processing (such as image drawing, annotating, converting and compressing). You may refer to it.