This seems like an obvious issue, but Google turns up nothing interesting. Is it legal to use memset
in a CUDA kernel such as:
__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.)
是的,如编程手册附录B中所述 ,设备代码支持memset
以及memcpy
, malloc
和free
(仅后者在Compute Capacity> = 2.0设备上提供)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.