Great Library, only found one problem

Dec 10, 2012 at 10:48 PM

Hi,

 

I have used almost every feature in your library and it has been awesome so far. However I am trying to use the cuda texture object and no matter what I try I seem to get a "Invalid" error when creating a cuda texture object. I have a 660 card and it supports 3.0 so it should be okay. Have you got this working? I have tried with arrays, and with pitched2d memory and neither works but they both work with a texture refernce.

 

Thanks and great work again!

Dec 10, 2012 at 11:05 PM

This might give you a better idea of how to create the issue

 

            ManagedCuda.CudaPitchedDeviceVariable<float> testVar = new ManagedCuda.CudaPitchedDeviceVariable<float>(100, 10);
            ManagedCuda.BasicTypes.CudaTextureDescriptor tex = new ManagedCuda.BasicTypes.CudaTextureDescriptor(ManagedCuda.BasicTypes.CUAddressMode.Clamp,ManagedCuda.BasicTypes.CUFilterMode.Linear,ManagedCuda.BasicTypes.CUTexRefSetFlags.None);
            ManagedCuda.BasicTypes.CudaResourceDesc resDes = new ManagedCuda.BasicTypes.CudaResourceDesc(testVar);                        ManagedCuda.CudaTexObject texObject = new ManagedCuda.CudaTexObject(resDes, tex);

 

causes the error.

Dec 10, 2012 at 11:07 PM

I suspect that the CudaResourceDesc is not working properly as I did a sizeof on the device and a sizeof on the interop size in .net and they are very different....

Coordinator
Dec 11, 2012 at 1:08 AM
Edited Dec 11, 2012 at 1:24 AM

Hi,

you're right, CudaResourceDesc is definitively wrong: The "flags" member is set to be at field offset 128 (32*4), but should be 132 (32*4 + offset of "resType"). And as flags must be set to zero, CUDA complains about the probably garbage values it obtains with the current release. The final size should then always be 136 bytes (managed and unmanaged code).

I fixed the code in the repository. It would be great if you could test it before I update the current release or create a new release, as I wont get a new GPU with 3.0 support before new year ;-)



best,

Michael

Dec 11, 2012 at 8:45 AM

Hi,

 

I will check it out when I get home tonight as my work computer doesn't have a 3.0 either.

Dec 11, 2012 at 9:25 PM

I tried it by editing the resourcedesc locally and it works fine if you add +4 to the offset of the flags. So I say go ahead with the change. If there is any other 3.0 features you want tested/debugged feel free to write here. I have subscribed to this channel.

Coordinator
Dec 11, 2012 at 10:57 PM

Thanks for the help! I will upload a new release with a new feature (texture binding using static methods) and other bug fixes in a few minutes. Actually there is no other 3.0 feature with a change in the Cuda-API that needs to be tested, but thanks again for offering the help.

Have fun with Cuda

Michael