[英]Using memset in a CUDA kernel
This seems like an obvious issue, but Google turns up nothing interesting. 这似乎是一个显而易见的问题,但是Google并没有发现任何有趣的事情。 Is it legal to use
memset
in a CUDA kernel such as: 在CUDA内核中使用
memset
是否合法,例如:
__device__ void myKernel()
{
int array[10];
memset(array, 0, sizeof(array));
// ...etc...
}
(I know int array[10] = {0};
is probably better, but this is just an example of a more complicated case.) (我知道
int array[10] = {0};
可能更好,但这只是更复杂情况的一个示例。)
是的,如编程手册附录B中所述 ,设备代码支持memset
以及memcpy
, malloc
和free
(仅后者在Compute Capacity> = 2.0设备上提供)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.