What's the 'right' way to implement a 32-bit memset for CUDA?

前端 未结 2 986
星月不相逢
星月不相逢 2021-01-24 04:04

CUDA has the API call

cudaError_t cudaMemset (void *devPtr, int value, size_t count)

which fills a buffer with a single-byte value. I want to f

2条回答
  •  情书的邮戳
    2021-01-24 04:18

    As of about CUDA 3.0, runtime API device pointers (and everything else) are interoperable with the driver API. So yes, you can use cuMemsetD32 to fill a runtime API allocation with a 32 bit value. The size of CUdeviceptr will match the size of void *on you platform and it is safe to cast a pointer from the CUDA API to CUdeviceptr or vice versa.

提交回复
热议问题