cuda .Net. LoadModule raise GASS.CUDA.CUDAException

Hi all!

I’m doing a program in C # using the technology Cuda. Net. My program compiles, and create a file mykernel.cubin using the following command line:

nvcc "C:\Users\alvahtin\Documents\Visual Studio 2008\Projects\TestCuda\TestCuda\mykernel.cu" --cubin --compiler-bindir="C:\Program Files\Microsoft Visual Studio 9.0\VC\bin"

But this module mykernel.cubin can not load. There is code, where the call LoadModule raise exception “GASS.CUDA.CUDAException”

cuda = new CUDA(0, true);

int[] array = Enumerable.Range(0, 4096).ToArray();

CUdeviceptr d_input = cuda.CopyHostToDevice(array);

/*FileStream Sr = new FileStream(Path.Combine(Environment.CurrentDirectory, "mykernel.cubin"), FileMode.Open);

byte[] module = new byte[Sr.Length];

Sr.Read(module, 0, module.Length);

cuda.LoadModule(module);*/ //I trying do else, but no results

CUmodule module = cuda.LoadModule(Path.Combine(Environment.CurrentDirectory, "mykernel.cubin"));//this is throw exception

CUfunction func = cuda.GetModuleFunction("test_func");

cuda.SetFunctionBlockShape(func, 512, 1, 1);

cuda.SetParameter(func, 0, (uint)d_input.Pointer);

cuda.SetParameter(func, IntPtr.Size, (uint)42);

cuda.SetParameterSize(func, (uint)(IntPtr.Size + sizeof(uint)));

cuda.Launch(func, array.Length / 512, 1);

cuda.CopyDeviceToHost(d_input, array);

cuda.Free(d_input);

foreach (var item in array)

{

Console.WriteLine(item);

}

}

catch (CUDAException ex)

{

Console.ForegroundColor = ConsoleColor.Red;

Console.WriteLine("CUDAException");

Console.WriteLine(ex.Message);

}

Console.ReadLine();

What could be the problem?

I found the solution my problem: http://forums.nvidia.com/index.php?showtopic=176722

command line of create a file mykernel.cubin must be following:

nvcc  "C:\Users\alvahtin\Documents\Visual Studio 2008\Projects\TestCuda\TestCuda\mykernel.cu" --cubin --compiler-bindir="C:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -arch=sm_20