Allocate Memory within Device? is it possible?

Is it possible?

something like:

in the device

I did this in one of the function of the device

it gives me the “out of memory” even I’ve allocated memory for the support1 and largeItem1. Hmm…

I tried this:

but I got this error:

what does that mean?

I’m not sure, tell me if I’m wrong. It just came up to my mind, since EmuDebug compilation will be run on the CPU, so when I do this on the device

even if I’ve allocated memory on the GPU through cudaMemalloc, it prints out “out of memory” because it checks through CPU?

cudaMalloc is a host function. It cannot be called from the device.

It’s the same with cuMemAlloc, correct?

Yes. You cannot call any CUDA API function from the device.

It is possible to simulate dynamic allocation in CUDA by allocating a big chunk of memory and then allocating sections to threads by using techniques like parallel prefix sum (see the scan example in the SDK).