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.)
Yes, as described in Appendix B of the programming manual, memset
, as well as memcpy
, malloc
, and free
(the latter two only on Compute capability >= 2.0 devices) are supported in device code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With