或者,如果我想确保数组包含全0,是否需要执行cudaMemset()?我在文档中找不到它。
谢谢。
最佳答案
Allocates
size
bytes of linear memory on the device and returns in*devPtr
a pointer to the allocated memory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared.
因此,您将需要
cudaMemset
来初始化内存。
关于c++ - cudaMalloc()是否将数组初始化为0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62055890/