This project is read-only.

Cuda surfaces

Sep 16, 2015 at 4:49 PM
Hi, do you have any working example using CudaSurface?
I want to write into a 3Dtexture from a kernel , but i think the solution is to use 3dSurfaces.

I got a CudaException when i try to bind my surface to the 3d Array of float.

the surface is declared like this in the .cu file :
surface<void, 3> tex_selected;
and in my .cs file i have something like this
tex_selected = new CudaArray3D(CUArrayFormat.Float, dimx, dimy, dimz, CudaArray3DNumChannels.One, CUDAArray3DFlags.None);
Do you have any solution ?
Sep 16, 2015 at 6:07 PM
You need to create tex_selected with flag
/// <summary>
/// this flag must be set in order to bind a surface reference
/// to the CUDA array
/// </summary>
SurfaceLDST = 2,
intead of CUDAArray3DFlags.None.

Sep 17, 2015 at 9:53 AM
Thank you. I used CUDAArray3DFlags.None because it was the only available choice in the version of managed Cuda i was using ( Cuda 6.0).
So i switched to the newest release and it's ok.
i have something like this:
tex_selected = new CudaArray3D(CUArrayFormat.Float, dimx, dimy, dimz, CudaArray3DNumChannels.One,CUDAArray3DFlags.SurfaceLDST);
thank you again