Dynamic Memory Allocation inside kernel Can we have a cudaMalloc((void**)&var, size) in our ke

Hi,

I have a piece of CUDA code, in which cudaMalloc((void**)&var,size) is inside the kernel on the GPU. This is useful for allocating memory on the GPU dynamically inside the kernel. Is it allowed?

Thanks in advance!

No it is not. And if you had actually tried compile your code for a device, you would know this, because nvcc would refuse to compile it.