Using memset in the CUDA core

This seems like an obvious problem, but Google is not causing anything interesting. Is it legal to use memsetCUDA in the kernel, for example:

__device__ void myKernel()
{
    int array[10];
    memset(array, 0, sizeof(array));
    // ...etc...
}

(I know that int array[10] = {0};is probably better, but this is just an example of a more complex case.)

+4
source share
1 answer

Yes, as described in Appendix B of the Programming Guide , memsetas well as memcpy, mallocand free(the latter two only functions Compute> = 2.0) are supported in device code.

+3
source

Source: https://habr.com/ru/post/1624236/


All Articles