GASS.CUDA.CUResult.ErrorInvalidImage error in CUDA.NET

326 Views Asked by At

I try to develop a form application using CUDA.NET in Visual Stuio C#. However I need to create cubin file, here is my problem:

I tried to create cubin file using Visual Studio. I changed the setting in Project Properties->Configuration Properties->Cuda Runtime API->GPU->NVCC Compilation Type to "Generate 64 bit .cubin file (-m64 -cubin)" from "Generate hybrid object file (--compile / -c)".

But I got this error "fatal error LNK1181: cannot open input file '.\Debug\histogram256.cu.obj'". It cannot find the object of some of my .cu files.

So I changed only those .cu files' "NVCC Compilation Type" setting to (-m64 -cubin) and compile them alone by right clicking on those files. However it did not create any .obj or .cubin file.

Then I tried to compile it from the command line. I copied the line in the .cu file's Property Page->Cuda Runtime API->Command Line which is

" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --machine 32 -ccbin "c:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -maxrregcount=0 --compile -o "Debug/device.cubin" "device.cu""

device.cu is my cuda file.

It created the .cubin file, but I got this error from CUDA.NET: "GASS.CUDA.CUResult.ErrorInvalidImage."

Do you have any suggestions?

1

There are 1 best solutions below

0
On

1: be sure that your viedecard support gencode-arch and code you specify.

2: You compile for 32 bit, be sure u are compiling and reference cuda.net for 32 bit also for .net.

3: Use managedcuda (codeplex) is much much better samples and documentation are provided.