cudamemsetcuda-drivercuda-arrays

Is it possible to run cuMemset on a CUarray?


I have a CUarray that I got from my OpenGL-context via cuGraphicsSubResourceGetMappedArray(). Is there a possiblity to use it with cuMemset*()?


Solution

  • Nope. You can't get a device pointer into a CUDA array (to pass to cuMemset*()), and NVIDIA has never shipped a memset function for CUDA arrays.

    You have to zero out some host memory and do a memcpy (or memcpy's) into the CUDA array, or (if your app runs only on SM 2.0 or later) roll your own with surface stores.